Add in-progress of day 6
This commit is contained in:
parent
1369b76f42
commit
da9286a477
57
data/Y23/day6/Day6.php
Normal file
57
data/Y23/day6/Day6.php
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace trizz\AdventOfCode\Y23;
|
||||||
|
|
||||||
|
final class Day6 extends \trizz\AdventOfCode\Solution
|
||||||
|
{
|
||||||
|
public static null|int|string $part1ExampleResult = null;
|
||||||
|
|
||||||
|
public static null|int|string $part1Result = null;
|
||||||
|
|
||||||
|
public static null|int|string $part2ExampleResult = null;
|
||||||
|
|
||||||
|
public static null|int|string $part2Result = null;
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
0 0
|
||||||
|
1 6
|
||||||
|
2 10
|
||||||
|
3 12
|
||||||
|
4 12
|
||||||
|
5 10
|
||||||
|
6 6
|
||||||
|
7 0
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#[\Override]
|
||||||
|
public function part1(array $data): int
|
||||||
|
{
|
||||||
|
$time = array_filter(explode(' ', $data[0]));
|
||||||
|
$distance = array_filter(explode(' ', $data[1]));
|
||||||
|
unset($time[0], $distance[0]);
|
||||||
|
$time = array_map('intval', array_values($time));
|
||||||
|
$distance = array_map('intval', array_values($distance));
|
||||||
|
|
||||||
|
$maxDistance = [];
|
||||||
|
foreach ($time as $key => $value) {
|
||||||
|
for ($i = 0; $i < $value; ++$i) {
|
||||||
|
// dump($time[$key]);
|
||||||
|
$maxDistance[$key][] = 7 + ($time[$key] - $i);
|
||||||
|
}
|
||||||
|
|
||||||
|
// dd($maxDistance);
|
||||||
|
}
|
||||||
|
|
||||||
|
// dd($maxDistance);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[\Override]
|
||||||
|
public function part2(array $data): int
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
0
data/Y23/day6/data.txt
Normal file
0
data/Y23/day6/data.txt
Normal file
2
data/Y23/day6/example.txt
Normal file
2
data/Y23/day6/example.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
Time: 7 15 30
|
||||||
|
Distance: 9 40 200
|
Loading…
x
Reference in New Issue
Block a user