100 % Faster Java Dp solution🔥🔥🔥🔥🔥🔥||
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```\nclass Solution {\n   \n    int dp[][];\n    public int lengthOfLongestSubsequence(List<Integer> nums, int target) {\n         int n=nums.size();\n         dp = new int[n][target+1];\n         \n        for(int i=0;i<n;i++) Arrays.fill(dp[i],-2);\n        \n         return f(0,n,target,nums);\n    \n    }\n    public int f(int idx,int n,int target,List<Integer> nums)\n    {   \n         if (target == 0) {\n            return 0;\n        }\n        \n        if (idx >= n || target < 0) {\n            return -1;\n        }\n\n        if (dp[idx][target] != -2) {\n            return dp[idx][target];\n        }\n        \n        int pick = f(idx + 1, n, target - nums.get(idx), nums);\n        int nopick = f(idx + 1, n, target, nums);\n\n        int result = -1;\n        if (pick != -1) {\n            result = pick + 1;\n        }\n        if (nopick != -1) {\n            result = Math.max(result, nopick);\n        }\n        \n        return dp[idx][target] = result;\n\n    }\n}\n```
['Dynamic Programming', 'Recursion', 'Memoization', 'Java']