Skip to content

Instantly share code, notes, and snippets.

@uxjp
Created September 25, 2022 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uxjp/5f6753d684aa1a48b8670726ff1a73dc to your computer and use it in GitHub Desktop.
Save uxjp/5f6753d684aa1a48b8670726ff1a73dc to your computer and use it in GitHub Desktop.
defmodule Ab do
def abs(x) when x < 0, do: x * -1
def abs(x), do: x
end
defmodule Solution do
IO.read(:all)
|> String.split
|> Enum.map(&String.to_integer/1)
|> Enum.map(&Ab.abs/1)
|> Enum.each(&IO.puts/1)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment