March punch card activity on day 14 of 300 LeetCode question: rise longest sequence (medium)
Title: Given a disordered array of integers, wherein the length of the longest found rising sequence.
Problem-solving ideas: you have not seen, and sent four not want to change, and who are not big weekend of rest that way. . .
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;}}
Problem solution practice 1: turn to find himself in front is smaller than the number of numbers.