Advanced application engineering analyst @Accenture l Ex-Full-stack Developer @Automation Agency India |1600+ Leetcode | Freelance Web Developer | AI for Businesses | Qualified Google Codejam
This could be your Pre-Interview Checklist for DSA -Binary Search
How to identify binary search problems?
1. The array will be sorted.
2. Time complexity of O(log n) will be mentioned in the problem
3. If you encounter a problem where you need to search for a particular element or find an optimal solution by repeatedly dividing the search space, binary search might be a good fit.
4. Many problem statements explicitly mention or hint at binary search. Look for keywords like “search,” “find,” “sorted,” “range,” or “divide and conquer” in the problem description.
5. With practice, you will start recognizing recurring problem patterns that are suited for binary search.
Questions List:
1. Find First and Last Position of Element in Sorted Array
2. Sqrt(x)
3. First Bad Version
4. Peak Index in a Mountain Array
5. Search in Rotated Sorted Array
6. Search in Rotated Sorted Array II
7. Find Minimum in Rotated Sorted Array
8. Find Minimum in Rotated Sorted Array II
9. Search in a 2D matrix — I
10. Search in a 2D matrix — II
12. H-Index II
Follow Tushar Verma for more coding-related content
#leetcode #binarysearch #dsa #coding #datastructuresandalgorithms #gfg #algorithms