@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | if ($n <= 0) { |
12 | 12 | return false; |
13 | 13 | } |
14 | - $helper = static function (int $num) { |
|
14 | + $helper = static function(int $num) { |
|
15 | 15 | [$sum, $tmp] = [0, null]; |
16 | 16 | while ($num) { |
17 | 17 | $tmp = $num % 10; |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | return false; |
38 | 38 | } |
39 | 39 | $visited = []; |
40 | - while ($n !== 1 && ! in_array($n, $visited, true)) { |
|
40 | + while ($n !== 1 && !in_array($n, $visited, true)) { |
|
41 | 41 | array_push($visited, $n); |
42 | - $n = array_sum(array_map(fn ($x) => $x ** 2, str_split((string) $n))); |
|
42 | + $n = array_sum(array_map(fn($x) => $x ** 2, str_split((string) $n))); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | return !in_array($n, $visited, true); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | } |
33 | 33 | [$m, $n] = [count($matrix), count($matrix[0])]; |
34 | 34 | [$low, $high] = [$matrix[0][0], $matrix[$m - 1][$n - 1]]; |
35 | - $helper = static function (array $matrix, int $target) { |
|
35 | + $helper = static function(array $matrix, int $target) { |
|
36 | 36 | $n = count($matrix); |
37 | 37 | [$cnt, $i, $j] = [0, $n - 1, 0]; |
38 | 38 | while ($i >= 0 && $j < $n) { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | }; |
48 | 48 | |
49 | 49 | while ($low < $high) { |
50 | - $mid = (int)(($high - $low) / 2) + $low; |
|
50 | + $mid = (int) (($high - $low) / 2) + $low; |
|
51 | 51 | $cnt = $helper($matrix, $mid); |
52 | 52 | if ($cnt < $k) { |
53 | 53 | $low = $mid + 1; |