DP
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
```csharp []
public class Solution {
    public int LengthOfLongestSubsequence(IList<int> nums, int target) {
        int len = nums.Count;
			
        int[] dp = Enumerable.Repeat(-1, target+1).ToArray();
        dp[0] = 0; 

        for (int i = 0; i < len; i++)
        {
            if (nums[i] > target)
                continue;

            for (int j = target - nums[i]; j >= 0; j--)
            {
                if (dp[j] == -1)
                    continue;

                dp[j + nums[i]] = Math.Max(dp[j+nums[i]], dp[j]+1);
            }
        }

        return dp[target];
    }
}
```
['C#']