Bottom-up DP, straightforward
Intuition\n Describe your first thoughts on how to solve this problem. \nBottom up, for each element n in nums and t in possible totals we update the value for 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nBottom up, for each element n in nums and t in possible totals we update the value for t+n\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nSince the array is exhaustive, we go from \'total\' to \'n\' for each element and update totals, in order to prevent using \'n\' twice\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\nO(mn)\nm: target\nn: len(nums)\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\nO(m)\n\n# Code\n```\nclass Solution:\n    def lengthOfLongestSubsequence(self, nums: List[int], target: int) -> int:\n        dp = [-1]*(target+1)\n        dp[0]=0\n        for n in nums:\n            for total in range(target,n-1,-1):\n                if dp[total-n]==-1:\n                    continue\n                dp[total]=max(dp[total],dp[total-n]+1)\n        return dp[-1]\n\n```
['Dynamic Programming', 'Python3']