int Solution::lengthOfLIS(vector<int> &nums){

if (nums.empty()) return 0;

```
int LIS_ind = 1;
for (int i = 1; i != nums.size(); ++i){
if (nums[i] > nums[LIS_ind-1]) {
nums[LIS_ind++] = nums[i];
}
else{
auto iter = lower_bound(nums.begin(), nums.begin()+LIS_ind, nums[i]);
*iter = nums[i];
}
}
return LIS_ind;
```

}