class Solution {
public:
int findLengthOfLCIS(vector<int>& nums) {
int max_length = 1;
int max_l = 0;
int slow = 0,fast = 1;
if(nums.size() == 1) return 1;
while(fast < nums.size())
{
if(nums[slow] < nums[fast])
{
max_length += 1;
}
else
{
max_l = max(max_l,max_length);
max_length = 1;
}
slow++;
fast++;
}
return max(max_l,max_length);
}
};
leetcode每日一题第129天
最新推荐文章于 2024-11-04 12:20:00 发布