Skip to content

Commit cbf6fd7

Browse files
committed
Merge branch 'main' of https://github.com/doocs/leetcode into main
2 parents 6182d5d + 76c3a8f commit cbf6fd7

File tree

165 files changed

+23493
-20946
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+23493
-20946
lines changed

images/starcharts.svg

Lines changed: 20243 additions & 20137 deletions

lcci/16.17.Contiguous Sequence/README.md

Lines changed: 20 additions & 1 deletion

lcci/16.17.Contiguous Sequence/README_EN.md

Lines changed: 20 additions & 1 deletion
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
/**
3+
* @param Integer[] $nums
4+
* @return Integer
5+
*/
6+
function maxSubArray($nums) {
7+
$pre = 0;
8+
$max = $nums[0];
9+
for ($i = 0; $i < count($nums); $i++) {
10+
$pre = max($pre + $nums[$i], $nums[$i]);
11+
$max = max($pre, $max);
12+
}
13+
return $max;
14+
}
15+
}
-17 KB
-30.6 KB
-30.8 KB
-25.1 KB
-94.9 KB
-94.9 KB

0 commit comments

Comments
 (0)