Search
⌘K

Leetcode 2386. Find the K-Sum of an Array

Given an integer array nums (n up to 1e5) and k ≤ min(2000, 2^n), return the k-th largest subsequence sum (the empty subsequence counts as 0). The core challenge is to avoid enumerating all 2^n sums and instead exploit the array's value structure to efficiently generate only the top-k subsequence sums.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.