← Questions

K largest subset sums

0
GoogleCodingLast asked Jan 2026

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.

Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding