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.
958 published notes across every category.
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.
Relative Sort Array (LeetCode 1122): sort by the order defined in a second array, with the rest sorted ascending. O(n log n), Python/Java/C++.
Wiggle Sort II (LeetCode 324): strict nums[0] < nums[1] > nums[2]... via sorting and interleaving the two halves in reverse. O(n log n), Python/Java/C...
H-Index (LeetCode 274) via sorting: sort citations descending and find the largest i where citations[i] >= i+1. O(n log n), Python/Java/C++.
Meeting Rooms (LeetCode 252): sort meetings by start and check that none overlaps the previous one. O(n log n), Python/Java/C++.