On-screen text
LeetCode
for beginners!
(save this for later!)
Part 2: Binary Search!
(from a software engineer)
swipe
@that_swe_intern
All content is for educational purposes
Google
Microsoft
amazon
I used this exact algorithm to
get my $60 / hr internship!
This is why you need to
know Binary Search.
The idea is simple...
swipe
@that_swe_intern
All content is for educational purposes
Say we have this sorted array...
1
2
3
4
5
6
7
↑
...and your job is to find the value 5.
Let's start!
4
↑
First, start at the midpoint, 4.
This is less than our target, 5.
Good Job
(Straight forward, right? Let's go on.)
swipe
@that_swe_intern
All content is for educational purposes
This next step is the key idea!
4
Our initial guess was too low...
...so we search on the right side!
4
6
↑
Again, we choose our new midpoint!
(this works because the array was sorted, so we know 5 is to the right of 4!)
Good Job
(Still makes sense? Let's go on.)
swipe
@that_swe_intern
All content is for educational purposes
Great job so far!
4
6
↑
By now, you know the next step!
The value 6 is greater than our target, 5...
...so we search to the left!
Finally, we found our target value!
swipe
@that_swe_intern
All content is for educational purposes
Congrats!
You've mastered Binary Search!
(this might get you your internship!)
You're on your way to a job with:
1. Great Pay
2. Work-Life Balance
3. Interesting Problems
Keep it up!
Follow to commit to your goal of breaking into tech!