classSolution{publicintlengthOfLIS(int[] nums){int max =0;int len = nums.length;if(len==0)return0;if(len==1)return1;int now =0;int left =0;int right =0;while(right<len){if(nums[left]<nums[right]){
max++;
now = nums[left];
left++;
right++;}elseif(nums[left]>=nums[right]){if(nums[right]>now && now!=0){
now = nums[right];}elseif(nums[right]<now){
now = nums[right];
max =0;}
left = right;
right++;}}return max+1;}}