diff options
Diffstat (limited to 'challenge-262/2colours/php/ch-1.php')
| -rw-r--r-- | challenge-262/2colours/php/ch-1.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/challenge-262/2colours/php/ch-1.php b/challenge-262/2colours/php/ch-1.php new file mode 100644 index 0000000000..c714bc2363 --- /dev/null +++ b/challenge-262/2colours/php/ch-1.php @@ -0,0 +1,7 @@ +<?php + +const PARENS = ['(', ')']; +const SQUARE_BRACKETS = ['[', ']']; +echo '@ints = '; +$ints = json_decode(str_replace(PARENS, SQUARE_BRACKETS, fgets(STDIN))); +echo max(...array_map(fn ($pred) => count(array_filter($ints, $pred)), [fn ($x) => $x > 0, fn ($x) => $x < 0]));
\ No newline at end of file |
