Search
⌘K

Leetcode 3428. Maximum and Minimum Sums of at Most Size K Subsequences

Compute the sum of minimum and maximum elements across all subsequences of nums of size ≤ k. Sort nums and use combinatorics to count how many subsequences make each element the min or max (with precomputed nCr/mod 1e9+7) to accumulate contributions efficiently for n up to 1e5 and k ≤ 70.


Question Timeline

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

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