| Total Complexity | 9 |
| Total Lines | 33 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 7 | class LongestContinuousIncreasingSubsequence |
||
| 8 | { |
||
| 9 | public static function findLengthOfLCIS(array $nums): int |
||
| 10 | { |
||
| 11 | if (empty($nums)) { |
||
| 12 | return 0; |
||
| 13 | } |
||
| 14 | $res = $cnt = 0; |
||
| 15 | for ($i = 0, $n = count($nums); $i < $n; $i++) { |
||
| 16 | if ($i === 0 || $nums[$i] > $nums[$i - 1]) { |
||
| 17 | $res = max($res, ++$cnt); |
||
| 18 | } else { |
||
| 19 | $cnt = 1; |
||
| 20 | } |
||
| 21 | } |
||
| 22 | |||
| 23 | return $res; |
||
| 24 | } |
||
| 25 | |||
| 26 | public static function findLengthOfLCIS2(array $nums): int |
||
| 40 | } |
||
| 41 | } |
||
| 42 |