Skip to content

Commit

Permalink
Add sum_map function to Day2 module
Browse files Browse the repository at this point in the history
  • Loading branch information
samjowen committed Dec 27, 2023
1 parent f01a9b1 commit 06c7f38
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/day2/day2.ex
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,8 @@ defmodule Day2 do
def extract_integer(string) do
remove_non_digits(string) |> String.to_integer()
end

def sum_map(map) do
Map.values(map) |> Enum.sum()
end
end

0 comments on commit 06c7f38

Please sign in to comment.