File tree 3 files changed +46
-0
lines changed
solution/0600-0699/0674.Longest Continuous Increasing Subsequence
3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -156,6 +156,23 @@ func max(a, b int) int {
156
156
}
157
157
```
158
158
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
+
159
176
### ** ...**
160
177
161
178
```
Original file line number Diff line number Diff line change @@ -140,6 +140,23 @@ func max(a, b int) int {
140
140
}
141
141
```
142
142
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
+
143
160
### ** ...**
144
161
145
162
```
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments