tabulation
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int t[1001][1001];
    int maxLength(vector<int>&nums, int target){
        int n=nums.size();
        for(int i=0;i<n+1;i++){
            for(int j=0;j<target+1;j++){
                if(j==0) t[i][j]=0;
                else t[i][j]=-1;
            }
        }
        for(int i=1;i<n+1;i++){
            for(int j=1;j<target+1;j++){
                if(nums[i-1]<=j && t[i-1][j-nums[i-1]]!=-1) t[i][j]=max(1+t[i-1][j-nums[i-1]], t[i-1][j]);
                else t[i][j]=t[i-1][j];
            }
        }
        return t[n][target];
    }
    int lengthOfLongestSubsequence(vector<int>& nums, int target) {
        memset(t,-1,sizeof(t));
        return maxLength(nums,target);
    }
};
```
['C++']