Binary Search

Problems using binary search techniques

33 lessons
84 min

Lessons

1. What is Binary Search

Pattern overview

2m

2. Prerequisites

What you need first

1m

3. When to Use

Pattern triggers

2m

4. When NOT to Use

Avoid forcing this pattern

2m

5. Search Space Thinking

Beyond sorted arrays

2m

6. LeetCode 704 Binary Search - Problem Statement

The problem

2m1 problems

7. LeetCode 704 Binary Search - Solution

The core idea

3m

8. LeetCode 704 Binary Search - Example and Complexity Analysis

Walkthrough and analysis

3m

9. LeetCode 704 Binary Search - Implementation

The approach

4m1 problems

10. LeetCode 33 Search in Rotated Sorted Array - Problem Statement

The problem

2m1 problems

11. Quiz: Rotated Array Property

Test your understanding

2m1 problems

12. LeetCode 33 Search in Rotated Sorted Array - Why Naive Fails

The trap

2m

13. LeetCode 33 Search in Rotated Sorted Array - Solution

The core idea

3m

14. LeetCode 33 Search in Rotated Sorted Array - Example and Complexity Analysis

Walkthrough and analysis

3m

15. LeetCode 33 Search in Rotated Sorted Array - Implementation

The approach

4m1 problems

16. LeetCode 34 Find First and Last Position of Element - Problem Statement

The problem

2m1 problems

17. LeetCode 34 Find First and Last Position of Element - Why Naive Fails

The trap

2m

18. LeetCode 34 Find First and Last Position of Element - Solution

The core idea

3m

19. LeetCode 34 Find First and Last Position of Element - Example and Complexity Analysis

Walkthrough and analysis

3m

20. LeetCode 34 Find First and Last Position of Element - Implementation

The approach

4m1 problems

21. LeetCode 875 Koko Eating Bananas - Problem Statement

The problem

2m1 problems

22. Quiz: Binary Search on Answer

Test your understanding

2m1 problems

23. LeetCode 875 Koko Eating Bananas - Why Naive Fails

The trap

2m

24. LeetCode 875 Koko Eating Bananas - Solution

The core idea

3m

25. LeetCode 875 Koko Eating Bananas - Example and Complexity Analysis

Walkthrough and analysis

3m

26. LeetCode 875 Koko Eating Bananas - Implementation

The approach

4m1 problems

27. LeetCode 4 Median of Two Sorted Arrays - Problem Statement

The problem

2m1 problems

28. LeetCode 4 Median of Two Sorted Arrays - Why Naive Fails

The trap

2m

29. LeetCode 4 Median of Two Sorted Arrays - Solution

The core idea

3m

30. LeetCode 4 Median of Two Sorted Arrays - Example and Complexity Analysis

Walkthrough and analysis

3m

31. LeetCode 4 Median of Two Sorted Arrays - Implementation

The approach

4m1 problems

32. Common Mistakes

Common errors to avoid

2m

33. Section Recap

Summary

1m

Practice Problems

3.
Search a 2D Matrixleetcodemedium
4.
Find Peak Elementleetcodemedium

Ready to start learning?

Access all 33 lessons with interactive content and progress tracking.