Sorting and Searching: Easy to Hard Problems
Easy
- Binary Search (Basic binary search in a sorted array)
- Search Insert Position (Finds the position to insert an element in a sorted array)
- Merge Sorted Array (Merges two sorted arrays)
- First Bad Version (Finds the first bad version in a range using binary search)
- Find Peak Element (Finds a peak element in an array using binary search)
Medium
- Kth Largest Element in an Array (Finds the Kth largest element using sorting or heap)
- Find Minimum in Rotated Sorted Array (Finds the minimum element in a rotated sorted array)
- Search in Rotated Sorted Array (Searches for an element in a rotated sorted array)
- Top K Frequent Elements (Finds the K most frequent elements using sorting and heap)
- Median of Two Sorted Arrays (Finds the median of two sorted arrays)
Hard
- Largest Rectangle in Histogram (Finds the largest rectangle in a histogram using stack-based approach)
- Trapping Rain Water (Calculates trapped water in an elevation map using two-pointer technique)
- Find K Pairs with Smallest Sums (Finds K pairs with the smallest sums from two sorted arrays using heap)
- Median of Two Sorted Arrays (Finds the median of two sorted arrays efficiently)
- Kth Largest Element in a Stream (Keeps track of the Kth largest element in a stream of numbers)