Golang 1D DP.
\npackage main\n\nimport "math"\n\nvar dp [1001]int\n\nfunc lengthOfLongestSubsequence(nums []int, target int) int {\n\tfor i := 1; i <= target; i++ {\n\t\tdp[i
```\npackage main\n\nimport "math"\n\nvar dp [1001]int\n\nfunc lengthOfLongestSubsequence(nums []int, target int) int {\n\tfor i := 1; i <= target; i++ {\n\t\tdp[i] = math.MinInt\n\t}\n\n\tdp[target] = -1\n\tfor _, num := range nums {\n\t\tfor i := target; i >= num; i-- {\n\t\t\tdp[i] = max(dp[i], 1+dp[i-num])\n\t\t}\n\t}\n\treturn dp[target]\n}\n\n```
['Go']