```
class Solution {
public:
int lengthOfLIS(vector<int>& nums) {
if(nums.size() == 0) {
return 0;
}
vector<int> f(nums.size(), 1);
int result = 1;
for(int i = 0 ; i < nums.size() ; ++i) {
for(int j = 0 ; j < i ; ++j) {
if(nums[j] < nums[i]) {
f[i] = max(f[i], f[j] + 1);
}
}
result = max(result, f[i]);
}
return result;
}
};
```