use delete_at instead of pop_at

This commit is contained in:
Adam Millerchip 2024-12-02 21:51:40 +09:00
parent 89ae345ad6
commit 1a3c2bb7c9

View file

@ -21,8 +21,7 @@ defmodule Day2 do
def part2(reports) do def part2(reports) do
Enum.count(reports, fn report -> Enum.count(reports, fn report ->
Enum.find_value(0..(length(report) - 1), false, fn dampen -> Enum.find_value(0..(length(report) - 1), false, fn dampen ->
{_, dampened} = List.pop_at(report, dampen) report |> List.delete_at(dampen) |> check_report()
check_report(dampened)
end) end)
end) end)
end end