@@ -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; |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | array_push($stack, -$num); |
31 | 31 | break; |
32 | 32 | case '*': |
33 | - array_push($stack, (int)(array_pop($stack) * $num)); |
|
33 | + array_push($stack, (int) (array_pop($stack) * $num)); |
|
34 | 34 | break; |
35 | 35 | case '/': |
36 | - array_push($stack, (int)(array_pop($stack) / $num)); |
|
36 | + array_push($stack, (int) (array_pop($stack) / $num)); |
|
37 | 37 | break; |
38 | 38 | } |
39 | 39 | [$num, $operator] = [0, $char]; |
@@ -56,16 +56,16 @@ discard block |
||
56 | 56 | $char = $s[$i]; |
57 | 57 | if (is_numeric($char)) { |
58 | 58 | if ($operator === '+') { |
59 | - array_push($stack, (int)$char); |
|
59 | + array_push($stack, (int) $char); |
|
60 | 60 | } |
61 | 61 | if ($operator === '-') { |
62 | - array_push($stack, -(int)$char); |
|
62 | + array_push($stack, -(int) $char); |
|
63 | 63 | } |
64 | 64 | if ($operator === '*') { |
65 | - array_push($stack, array_pop($stack) * (int)$char); |
|
65 | + array_push($stack, array_pop($stack) * (int) $char); |
|
66 | 66 | } |
67 | 67 | if ($operator === '/') { |
68 | - array_push($stack, (int)(array_pop($stack) / $char)); |
|
68 | + array_push($stack, (int) (array_pop($stack) / $char)); |
|
69 | 69 | } |
70 | 70 | } else { |
71 | 71 | $operator = $char; |