# Binary Search Study Guide
:::warning
[< Return to Home Page](https://hackmd.io/@siansiansu/HknJJm0W0)
:::
Classic Binary Search
---------------------
The fundamental binary search algorithm used to efficiently locate a target value within a sorted array.
### Practice Problems
- 🟩 [704\. Binary Search](https://leetcode.com/problems/binary-search/) \[[Solution](https://hackmd.io/@siansiansu/H1kUBIDfA)\]
- 🟨 [74\. Search a 2D Matrix](https://leetcode.com/problems/search-a-2d-matrix/)
Modified Binary Search
----------------------
Variations of the binary search algorithm adapted for specific problem constraints or data arrangements.
### Practice Problems
- 🟨 [33\. Search in Rotated Sorted Array](https://leetcode.com/problems/search-in-rotated-sorted-array/)
- 🟨 [153\. Find Minimum in Rotated Sorted Array](https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/)
- 🟨 [162\. Find Peak Element](https://leetcode.com/problems/find-peak-element/)
Binary Search on Answer
-----------------------
Using binary search to find an optimal answer within a range of possible solutions.
### Practice Problems
- 🟨 [287\. Find the Duplicate Number](https://leetcode.com/problems/find-the-duplicate-number/)
- 🟥 [1235\. Maximum Profit in Job Scheduling](https://leetcode.com/problems/maximum-profit-in-job-scheduling/)
Binary Search with Boundaries
-----------------------------
Problems involving finding the boundaries or specific positions using binary search.
### Practice Problems
- 🟨 [34\. Find First and Last Position of Element in Sorted Array](https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/) \[[Solution](https://hackmd.io/@siansiansu/ByiKDD7H0)\]
- 🟩 [35\. Search Insert Position](https://leetcode.com/problems/search-insert-position/) \[[Solution](https://hackmd.io/@siansiansu/HJnzXBJS0)\]
- 🟩 [278\. First Bad Version](https://leetcode.com/problems/first-bad-version/)
Binary Search in Complex Data Structures
----------------------------------------
Applying binary search principles to more complex data structures or scenarios.
### Practice Problems
- 🟨 [981\. Time Based Key-Value Store](https://leetcode.com/problems/time-based-key-value-store/)
- 🟨 [528\. Random Pick with Weight](https://leetcode.com/problems/random-pick-with-weight/)
Advanced Binary Search Applications
-----------------------------------
Challenging problems that require sophisticated applications of binary search concepts.
### Practice Problems
- 🟥 [4\. Median of Two Sorted Arrays](https://leetcode.com/problems/median-of-two-sorted-arrays/)
- 🟨 [1508\. Range Sum of Sorted Subarray Sums](https://leetcode.com/problems/range-sum-of-sorted-subarray-sums/) \[[Solution](https://hackmd.io/@siansiansu/ryFvP92KA)\]
Problem Difficulty Legend
-------------------------
- 🟩 Easy
- 🟨 Medium
- 🟧 Medium-Hard
- 🟥 Hard
- ⬛ Very Hard
Additional Resources
--------------------
- [Binary Search Algorithm (Video)](https://www.youtube.com/watch?v=P3YID7liBug)
- [Binary Search Techniques (GeeksforGeeks)](https://www.geeksforgeeks.org/binary-search/)
- [Advanced Binary Search Problems (LeetCode Discussion)](https://leetcode.com/discuss/general-discussion/786126/python-powerful-ultimate-binary-search-template-solved-many-problems)