Skip to content

Commit 768337c

Browse files
committed
feat: add ts solution to lc problem: No.0674
No.0674.Longest Continuous Increasing Subsequence
1 parent dcc62e9 commit 768337c

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

solution/0600-0699/0674.Longest Continuous Increasing Subsequence/README.md

+17
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,23 @@ func max(a, b int) int {
156156
}
157157
```
158158

159+
### **TypeScript**
160+
161+
```ts
162+
function findLengthOfLCIS(nums: number[]): number {
163+
const n = nums.length;
164+
let res = 1;
165+
let i = 0;
166+
for (let j = 1; j < n; j++) {
167+
if (nums[j - 1] >= nums[j]) {
168+
res = Math.max(res, j - i);
169+
i = j;
170+
}
171+
}
172+
return Math.max(res, n - i);
173+
}
174+
```
175+
159176
### **...**
160177

161178
```

solution/0600-0699/0674.Longest Continuous Increasing Subsequence/README_EN.md

+17
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,23 @@ func max(a, b int) int {
140140
}
141141
```
142142

143+
### **TypeScript**
144+
145+
```ts
146+
function findLengthOfLCIS(nums: number[]): number {
147+
const n = nums.length;
148+
let res = 1;
149+
let i = 0;
150+
for (let j = 1; j < n; j++) {
151+
if (nums[j - 1] >= nums[j]) {
152+
res = Math.max(res, j - i);
153+
i = j;
154+
}
155+
}
156+
return Math.max(res, n - i);
157+
}
158+
```
159+
143160
### **...**
144161

145162
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
function findLengthOfLCIS(nums: number[]): number {
2+
const n = nums.length;
3+
let res = 1;
4+
let i = 0;
5+
for (let j = 1; j < n; j++) {
6+
if (nums[j - 1] >= nums[j]) {
7+
res = Math.max(res, j - i);
8+
i = j;
9+
}
10+
}
11+
return Math.max(res, n - i);
12+
}

0 commit comments

Comments
 (0)