Skip to content

Commit df9ad30

Browse files
committed
Remove another helper
1 parent bbbc8d8 commit df9ad30

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/aoc_2024/day_2.gleam

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub fn pt_2(input: List(List(Int))) {
3939
input
4040
|> list.count(fn(line) {
4141
line
42-
|> extra.selections
43-
|> list.any(fn(selection) { is_ok(selection.1) })
42+
|> list.combinations(list.length(line) - 1)
43+
|> list.any(is_ok)
4444
})
4545
}

src/extra.gleam

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ pub fn remove_at(xs: List(a), at i: Int) -> List(a) {
5050
list.append(list.take(xs, i), list.drop(xs, i + 1))
5151
}
5252

53-
/// selections([5,10,2]) -> [ #(5,[10,2]), #(10,[5,2]), #(2,[5,10]) ]
54-
pub fn selections(xs: List(a)) -> List(#(a, List(a))) {
55-
list.index_map(xs, fn(x, i) { #(x, remove_at(xs, i)) })
56-
}
57-
5853
pub fn yolo_int(x: String) -> Int {
5954
let assert Ok(n) = int.parse(x)
6055
n

0 commit comments

Comments
 (0)