We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0abd2c1 commit cd22dacCopy full SHA for cd22dac
674.data
@@ -0,0 +1,2 @@
1
+[1,3,5,4,7]
2
+[1,3,5,4,2,3,4,5]
674.最长连续递增序列.js
@@ -0,0 +1,33 @@
+/*
+ * @lc app=leetcode.cn id=674 lang=javascript
3
+ *
4
+ * [674] 最长连续递增序列
5
+ */
6
+
7
+// @lc code=start
8
+/**
9
+ * @param {number[]} nums
10
+ * @return {number}
11
12
+var findLengthOfLCIS = function(nums) {
13
+ if (nums.length === 0) {
14
+ return 0;
15
+ } else if (nums.length === 1) {
16
+ return 1;
17
+ }
18
19
+ let result = 0;
20
+ let current = 1;
21
+ for (let i = 1; i < nums.length; i++) {
22
+ if (nums[i] > nums[i - 1]) {
23
+ current++;
24
+ } else {
25
+ current = 1;
26
27
+ result = Math.max(result, current);
28
29
30
+ return result;
31
+};
32
+// @lc code=end
33
0 commit comments