Skip to content

Commit 6ab1185

Browse files
committed
Solution as on 25-03-2022 06:20 pm
1 parent 90b6ced commit 6ab1185

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// 674.✅ Longest Continuous Increasing Subsequence
2+
3+
class Solution
4+
{
5+
public:
6+
int findLengthOfLCIS(vector<int> &nums)
7+
{
8+
int cnt = 1, res = 0;
9+
10+
if (nums.size() == 0)
11+
return 0;
12+
if (nums.size() == 1)
13+
return 1;
14+
15+
for (int i = 1; i < nums.size(); ++i)
16+
{
17+
if (nums[i - 1] < nums[i])
18+
++cnt;
19+
else
20+
cnt = 1;
21+
22+
res = max(cnt, res);
23+
}
24+
25+
return res;
26+
}
27+
};

0 commit comments

Comments
 (0)