Small and Simple Java Solution that beats 98%/80%
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$$O(n*target)$$\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n$$O(n)$$\n# Code\n```java []\nclass Solution {\n    public int lengthOfLongestSubsequence(List<Integer> nums, int target) {\n        int[] dp=new int[target+1];\n        for(int v:nums){\n            for(int i=target-v;i>0;i--)\n                if(dp[i]!=0)\n                    dp[i+v]=Math.max(dp[i+v],dp[i]+1);\n            if(v<=target)\n                dp[v]=Math.max(dp[v],1);\n        }\n        return (dp[target]==0)?-1:dp[target];\n    }\n}\n```
['Array', 'Dynamic Programming', 'Java']