You are using an outdated browser. Please update your browser for a better user experience.

K'th Largest Element


Given an array of numbers A, and positive integer k, find the K'th largest element in the array.


A = [5, 5, 9, 10, 2, 12, 3, 6] , k = 3

K'th largest element in the array is 9

1 ≤ k ≤ n
The given array will not necessarily be sorted
This problem is...

Last Stone Weight

trees heaps

We have a collection of stones, each stone has a positive integer weight.

Each turn, we choose the two heaviest stones and smash them together. Suppose the stones have weights x and y with x less than or equal to y. The result of this smash is:

If x == y, both stones are totally destroyed;...

Merge Lists of Different Lengths


Alright so you have an assortment of sorted lists.
Unfortunately for you, they're of varying lengths.

So to rub some more salt on the wound, make it into a heap!
If I were you, I would ditch the whole multiple arrays and make one big one.
This would obviously mean that you would need t...