Data Structures
Kth Largest Element (Sorting Approach)
Kth Largest Element (LeetCode 215) via sorting: sort and index from the end in O(n log n), with a note on the O(n)-average quickselect alternative.
2 notes tagged
Kth Largest Element (LeetCode 215) via sorting: sort and index from the end in O(n log n), with a note on the O(n)-average quickselect alternative.
Count of Smaller Numbers After Self (LeetCode 315): scan right to left and binary-search each value into a sorted list to count smaller elements.