Tap here to switch tabs
Problem
Submissions

Problem: Length of the Longest Subsequence That Sums to Target

Try to solve the Length of the Longest Subsequence That Sums to Target problem.

Statement

You are given an integer array nums and an integer target.

Return the length of the longest subsequence of nums whose elements sum to target. If no such subsequence exists, return −1-1.

Constraints:

  • 1≤1 \leq nums.length ≤1000\leq 1000

  • 1≤1 \leq nums[i] ≤1000\leq 1000

  • 1≤1 \leq target ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Length of the Longest Subsequence That Sums to Target

Try to solve the Length of the Longest Subsequence That Sums to Target problem.

Statement

You are given an integer array nums and an integer target.

Return the length of the longest subsequence of nums whose elements sum to target. If no such subsequence exists, return −1-1.

Constraints:

  • 1≤1 \leq nums.length ≤1000\leq 1000

  • 1≤1 \leq nums[i] ≤1000\leq 1000

  • 1≤1 \leq target ≤1000\leq 1000