mirror of
https://github.com/wezm/advent-of-code.git
synced 2024-12-18 18:29:55 +00:00
Day 1 part 2
This commit is contained in:
parent
24ed6713e9
commit
f9db17b2e3
1 changed files with 6 additions and 2 deletions
|
@ -1,7 +1,6 @@
|
||||||
import gleam/string
|
import gleam/string
|
||||||
import gleam/int
|
import gleam/int
|
||||||
import gleam/list
|
import gleam/list
|
||||||
import gleam/io
|
|
||||||
|
|
||||||
pub fn pt_1(input: String) -> Int {
|
pub fn pt_1(input: String) -> Int {
|
||||||
assert Ok(max) =
|
assert Ok(max) =
|
||||||
|
@ -12,7 +11,12 @@ pub fn pt_1(input: String) -> Int {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn pt_2(input: String) -> Int {
|
pub fn pt_2(input: String) -> Int {
|
||||||
todo
|
string.split(input, on: "\n")
|
||||||
|
|> aggregate_calories([0])
|
||||||
|
|> list.sort(int.compare)
|
||||||
|
|> list.reverse
|
||||||
|
|> list.take(3)
|
||||||
|
|> int.sum
|
||||||
}
|
}
|
||||||
|
|
||||||
fn aggregate_calories(lines: List(String), sums: List(Int)) -> List(Int) {
|
fn aggregate_calories(lines: List(String), sums: List(Int)) -> List(Int) {
|
||||||
|
|
Loading…
Reference in a new issue