dsa1 min read
Count Smaller Numbers After Self — Merge Sort or Binary Indexed Tree
Count smaller elements to the right of each element using merge sort with position tracking in O(n log n).
Read →
webcoderspeed.com
1276 articles
Count smaller elements to the right of each element using merge sort with position tracking in O(n log n).
Find the maximum number of nested envelopes by sorting by width ascending then height descending, then applying LIS.
Minimize the maximum value after performing k operations (average adjacent elements) using binary search on the answer.
Find the maximum length to cut k ribbons from given ribbons using binary search on the ribbon length.
Maximize nums[index] given array length n, sum constraint maxSum, and each element >= 1 using binary search on the peak value.