1
0
Fork 0

solve 2021 day 18

This commit is contained in:
Sloane Perrault 2022-09-21 09:19:54 -04:00
parent edbe13c0ca
commit 170cf2c38f
2 changed files with 11 additions and 1 deletions

View file

@ -16,7 +16,7 @@
| :-: | :-: | :-: | :-: | :-: | :-: | :-: |
| | | | [1] | [2] | [3] | [4] |
| [5] | [6] | [7] | [8] | [9] | [10] | [11]|
| [12]| [13]| [14]| [15] | [16] | [17] | 18 |
| [12]| [13]| [14]| [15] | [16] | [17] | [18] |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
<!-- links -->
@ -38,3 +38,4 @@
[15]: ./lib/2021/15.ex
[16]: ./lib/2021/16.ex
[17]: ./lib/2021/17.ex
[18]: ./lib/2021/18.ex

View file

@ -10,6 +10,15 @@ aoc 2021, 18 do
end
def p2 do
numbers = input() |> Enum.to_list()
for a <- numbers, b <- numbers, a != b do
concat(a, b)
|> reduce()
|> to_lists()
|> magnitude()
end
|> Enum.max()
end
def magnitude([a, b]) do