2915. Length of the Longest Subsequence That Sums to Target
You are given a 0-indexed array of integers
nums
, and an integertarget
.Return the length of the longest subsequence of
nums
that sums up totarget
. If no such subsequence exists, return-1
.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 { |