Skip to content

Commit f46f935

Browse files
authored
feat: add php solution to lc problem: No.0647 (doocs#968)
1 parent 3de8be6 commit f46f935

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

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

+21
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,27 @@ function findLengthOfLCIS(nums: number[]): number {
172172
}
173173
```
174174

175+
### **PHP**
176+
177+
```php
178+
class Solution {
179+
/**
180+
* @param Integer[] $nums
181+
* @return Integer
182+
*/
183+
function findLengthOfLCIS($nums) {
184+
$tmp = $max = 1;
185+
for ($i = 0; $i < count($nums) - 1; $i++) {
186+
if ($nums[$i] < $nums[$i + 1]) {
187+
$tmp++;
188+
$max = max($max, $tmp);
189+
} else $tmp = 1;
190+
}
191+
return $max;
192+
}
193+
}
194+
```
195+
175196
### **...**
176197

177198
```

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

+21
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,27 @@ function findLengthOfLCIS(nums: number[]): number {
156156
}
157157
```
158158

159+
### **PHP**
160+
161+
```php
162+
class Solution {
163+
/**
164+
* @param Integer[] $nums
165+
* @return Integer
166+
*/
167+
function findLengthOfLCIS($nums) {
168+
$tmp = $max = 1;
169+
for ($i = 0; $i < count($nums) - 1; $i++) {
170+
if ($nums[$i] < $nums[$i + 1]) {
171+
$tmp++;
172+
$max = max($max, $tmp);
173+
} else $tmp = 1;
174+
}
175+
return $max;
176+
}
177+
}
178+
```
179+
159180
### **...**
160181

161182
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Solution {
2+
/**
3+
* @param Integer[] $nums
4+
* @return Integer
5+
*/
6+
function findLengthOfLCIS($nums) {
7+
$tmp = $max = 1;
8+
for ($i = 0; $i < count($nums) - 1; $i++) {
9+
if ($nums[$i] < $nums[$i + 1]) {
10+
$tmp++;
11+
$max = max($max, $tmp);
12+
} else $tmp = 1;
13+
}
14+
return $max;
15+
}
16+
}

0 commit comments

Comments
 (0)