very easy solution using recursion
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```javascript []\nfunction lengthOfLongestSubsequence(nums, target) {\n    let dp =  new Array(nums.length).fill(Number.MIN_SAFE_INTEGER).map(el => new Array(target+1).fill(Number.MIN_SAFE_INTEGER));\n    let result = helper(nums, 0, target, dp);\n    if (result <= 0) return -1;\n    return result;\n}\n\nfunction helper(nums, i, target, dp) {\n    // terminate\n    if (target == 0) return 0;\n    if (target < 0) return Number.MIN_SAFE_INTEGER;\n    if (i >= nums.length) return Number.MIN_SAFE_INTEGER;\n    if (dp[i][target] != Number.MIN_SAFE_INTEGER) return dp[i][target];\n    \n    // enumerate\n    let take = 1 + helper(nums, i + 1, target - nums[i], dp);\n    let skip = helper(nums, i + 1, target, dp);\n    return dp[i][target] = Math.max(take, skip);\n}\n```
['JavaScript']