Search
⌘K

Leetcode 3098. Find the Sum of Subsequence Powers

Compute the sum (mod 1e9+7) of the "power" of every k-element subsequence of nums, where a subsequence's power is the minimum absolute difference between any two of its elements. With n ≤ 50 this requires sorting and combinatorial counting/DP to aggregate each possible gap's contribution efficiently rather than enumerating all subsets.


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.