GoLang Solution DP 1D (easy understand)
\n# Code\n\nfunc max(a, b int) int {\n    if a > b {\n        return a\n    }\n    return b\n}\n\nfunc lengthOfLongestSubsequence(nums []int, target int) int {\
\n# Code\n```\nfunc max(a, b int) int {\n    if a > b {\n        return a\n    }\n    return b\n}\n\nfunc lengthOfLongestSubsequence(nums []int, target int) int {\n    dp := make([]int, target + 1)\n    \n\tfor i := range dp {\n\t\tdp[i] = -1\n\t}\n\tdp[0] = 0\n    for i := range nums {\n        for j := target; j > 0; j-- {\n            if (j - nums[i] >= 0) && (dp[j - nums[i]] != -1){\n                dp[j] = max(dp[j], dp[j - nums[i]] + 1)\n            }\n            //fmt.Println(dp)\n        }\n    }\n    //fmt.Println(dp)\n    return dp[target]\n}\n\n```
['Go']