← Questions
K largest subset sums
0
I was asked this
No reports yet. Sign in to say where you were asked it.
You get n items with non-negative weights. Return the k largest subset sums, in decreasing order (subsets are distinct by the items they contain). Brute force over all subsets is exponential; generate the sums in order with a max-heap.
No official answer yet. Write yours on the right and run it.
Nothing published yet.
Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding
