#3428
Maximum and Minimum Sums of at Most Size K Subsequences
expert · 1195 · lc medium +32 · 21.7% accepted · 147 likes · top 2%
Description
You are given an integer array nums and a positive integer k. Return the sum of the maximum and minimum elements across all subsequences of nums with at most k elements.
Since the answer may be very large, return it modulo 109 + 7.
Code
1
2
3