How to partition an array, made simple

While messing around on Leetcode the other day, I stumbled upon the problem of finding the k-th largest elements in an array. The straight-forward O(n*log(n)) solution would be to just sort the array and take the first k elements. However, those of you that are coding wizards might know that this problem can actually be […]

Scroll to top