Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf4ff34a

Browse files
committed
674-longest-continuous-increasing-subsequence.md Added another solution in Python.
1 parent8a9bca8 commitf4ff34a

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

‎en/1-1000/674-longest-continuous-increasing-subsequence.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ class Solution {
8484
```
8585

8686
##Python
87+
###Solution 1
8788
```python
8889
classSolution:
8990
deffindLengthOfLCIS(self,nums: List[int]) ->int:
@@ -99,6 +100,25 @@ class Solution:
99100
returnmax(dp)
100101
```
101102

103+
###Solution 2
104+
```python
105+
classSolution:
106+
deffindLengthOfLCIS(self,nums: List[int]) ->int:
107+
result=1
108+
current_length=1
109+
110+
for iinrange(1,len(nums)):
111+
if nums[i]> nums[i-1]:
112+
current_length+=1
113+
114+
if current_length> result:
115+
result= current_length
116+
else:
117+
current_length=1
118+
119+
return result
120+
```
121+
102122
##C++
103123
```cpp
104124
// Welcome to create a PR to complete the code of this language, thanks!

‎zh/1-1000/674-longest-continuous-increasing-subsequence.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ class Solution {
8484
```
8585

8686
##Python
87+
###Solution 1
8788
```python
8889
classSolution:
8990
deffindLengthOfLCIS(self,nums: List[int]) ->int:
@@ -99,6 +100,25 @@ class Solution:
99100
returnmax(dp)
100101
```
101102

103+
###Solution 2
104+
```python
105+
classSolution:
106+
deffindLengthOfLCIS(self,nums: List[int]) ->int:
107+
result=1
108+
current_length=1
109+
110+
for iinrange(1,len(nums)):
111+
if nums[i]> nums[i-1]:
112+
current_length+=1
113+
114+
if current_length> result:
115+
result= current_length
116+
else:
117+
current_length=1
118+
119+
return result
120+
```
121+
102122
##C++
103123
```cpp
104124
// Welcome to create a PR to complete the code of this language, thanks!

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp