Skip to content

Commit 9fe5b61

Browse files
authored
Create Solution.java
1 parent cbc09a6 commit 9fe5b61

File tree

1 file changed

+17
-0
lines changed
  • solution/0674.Longest Continuous Increasing Subsequence

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class Solution {
2+
public int findLengthOfLCIS(int[] nums) {
3+
if (nums == null || nums.length == 0) {
4+
return 0;
5+
}
6+
int cnt = 1;
7+
int res = 1;
8+
for (int i = 1; i < nums.length; ++i) {
9+
if (nums[i] > nums[i - 1]) {
10+
res = Math.max(res, ++cnt);
11+
} else {
12+
cnt = 1;
13+
}
14+
}
15+
return res;
16+
}
17+
}

0 commit comments

Comments
 (0)