题目链接:https://leetcode.com/problems/longest-continuous-increasing-subsequence/description/
class Solution { public: int findLengthOfLCIS(vector<int>& nums) { int n = nums.size(); if(n<=1) return n; int res = 1, len=1; for(int i=1; i<n; i++){ if(nums[i] > nums[i-1]) len+=1; else len = 1; res = max(len, res); } return res; } };
原文地址:https://www.cnblogs.com/cstdio1/p/11617592.html
时间: 2024-11-08 20:28:20