@@ -27,7 +27,7 @@ |
||
27 | 27 | return 0; |
28 | 28 | } |
29 | 29 | |
30 | - $helper = static function (array $map) use ($n) { |
|
30 | + $helper = static function(array $map) use ($n) { |
|
31 | 31 | for ($i = 1; $i < $n; $i++) { |
32 | 32 | $map[$i] += $map[$i - 1]; |
33 | 33 | } |
@@ -32,7 +32,7 @@ |
||
32 | 32 | if ($n <= 0 || (isset($s[0]) && $s[0] === '0')) { |
33 | 33 | return 0; |
34 | 34 | } |
35 | - $helper = static function ($s, $start, $length) { |
|
35 | + $helper = static function($s, $start, $length) { |
|
36 | 36 | $len = $start > $length ? $start : $length; |
37 | 37 | $pos = $start > $length ? 1 : $start; |
38 | 38 | $tmp = substr($s, 0, $len); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | if ($n <= 0) { |
13 | 13 | return 0; |
14 | 14 | } |
15 | - $helper = static function () use ($prices) { |
|
15 | + $helper = static function() use ($prices) { |
|
16 | 16 | [$buy, $sell] = [0, -$prices[0]]; |
17 | 17 | foreach ($prices as $i => $price) { |
18 | 18 | $tmp = $buy - $price; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | if ($n <= 0) { |
49 | 49 | return 0; |
50 | 50 | } |
51 | - $helper = static function () use ($prices) { |
|
51 | + $helper = static function() use ($prices) { |
|
52 | 52 | [$n, $maxProfit] = [count($prices), 0]; |
53 | 53 | for ($i = 1; $i < $n; $i++) { |
54 | 54 | if ($prices[$i] > $prices[$i - 1]) { |
@@ -13,7 +13,7 @@ |
||
13 | 13 | return $ans; |
14 | 14 | } |
15 | 15 | |
16 | - $isSameArray = static function (array $needle, array $haystack = []) { |
|
16 | + $isSameArray = static function(array $needle, array $haystack = []) { |
|
17 | 17 | sort($needle); |
18 | 18 | foreach ($haystack as $value) { |
19 | 19 | sort($value); |
@@ -12,7 +12,7 @@ |
||
12 | 12 | if ($m <= 0 || $n <= 0) { |
13 | 13 | return $ans; |
14 | 14 | } |
15 | - $helper = static function (array $array, int $k) { |
|
15 | + $helper = static function(array $array, int $k) { |
|
16 | 16 | $n = count($array); |
17 | 17 | if ($n < $k) { |
18 | 18 | return 0; |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | if ($len < 2) { |
13 | 13 | return $str; |
14 | 14 | } |
15 | - $helper = static function (string $str) { |
|
15 | + $helper = static function(string $str) { |
|
16 | 16 | $len = strlen($str); |
17 | 17 | for ($i = 0; $i < $len / 2; $i++) { |
18 | 18 | if ($str[$i] !== $str[$len - $i - 1]) { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | |
46 | 46 | $start = $length = 0; |
47 | - $helper = static function (string $str, int $left, int $right, int &$start, int &$length) { |
|
47 | + $helper = static function(string $str, int $left, int $right, int &$start, int &$length) { |
|
48 | 48 | while ($left >= 0 && $right < strlen($str) && $str[$left] === $str[$right]) { |
49 | 49 | $left--; |
50 | 50 | $right++; |
@@ -12,7 +12,7 @@ |
||
12 | 12 | if ($m === 0 || $n === 0) { |
13 | 13 | return false; |
14 | 14 | } |
15 | - $helper = static function (array &$array, int $k, int $v) { |
|
15 | + $helper = static function(array &$array, int $k, int $v) { |
|
16 | 16 | $array[$k][$v] = isset($array[$k][$v]) ? $array[$k][$v] + 1 : 1; |
17 | 17 | }; |
18 | 18 | $row = $col = $box = array_fill(0, $m, array_fill(0, $n, 0)); |
@@ -11,7 +11,7 @@ |
||
11 | 11 | if (empty($arr) || empty($queries)) { |
12 | 12 | return []; |
13 | 13 | } |
14 | - $sum = array_sum(array_filter($arr, function ($val) { |
|
14 | + $sum = array_sum(array_filter($arr, function($val) { |
|
15 | 15 | return $val % 2 === 0; |
16 | 16 | })); |
17 | 17 | $ans = []; |