-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path674. 最长连续递增序列.cc
41 lines (38 loc) · 1019 Bytes
/
674. 最长连续递增序列.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
* Description: 最长连续递增序列
* Author: AskeyNil
* CreateDate: 2019-09-24 09:13:37
* LastEditors: AskeyNil
*
* *********************************
* ** **
* ** 你只有足够努力 **
* ** 才能看上去毫不费力 **
* ** **
* *********************************
*
*/
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int findLengthOfLCIS(vector<int> &nums) {
if (nums.empty())
return 0;
int max_count = 0, count = 1, *left = nullptr;
for (int &num : nums) {
if (left != nullptr) {
if (num > *left)
count += 1;
else {
if (max_count < count)
max_count = count;
count = 1;
}
}
left = #
}
return max_count > count ? max_count : count;
}
};