2099. Find Subsequence of Length K With the Largest Sum
You are given an integer array
numsand an integerk. You want to find a subsequence ofnumsof lengthkthat has the largest sum.Return *any such subsequence as an integer array of length*
k.A subsequence is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining elements.
1 | class Solution { |