4th day
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$input = file('input', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
$input = array_map(fn($line) => str_split($line), $input);
|
||||
$input = array_map('str_split', $input);
|
||||
$gamma = $epsilon = [];
|
||||
for ($i = 0; $i < count($input[0]); $i++) {
|
||||
$bit = (int) (array_sum($column = array_column($input, $i)) >= ceil(count($column) / 2));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$input = file('input', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||
$input = array_map(fn($line) => str_split($line), $input);
|
||||
$input = array_map('str_split', $input);
|
||||
|
||||
$o2 = $co2 = $input;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user