Skip to content

Instantly share code, notes, and snippets.

@netodevel
Created June 20, 2017 14:41
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 netodevel/39deb33b02d6314e615867f82ac07e79 to your computer and use it in GitHub Desktop.
Save netodevel/39deb33b02d6314e615867f82ac07e79 to your computer and use it in GitHub Desktop.
defmodule Solution do
def main() do
n = IO.gets("") |> String.strip |> String.to_integer
IO.gets("") |> to_list(n)
end
def read_lines
IO.gets("")
end
def to_list(input, n) do
input
|> String.split
|> Enum.map(fn(x) -> String.to_integer(x) end)
|> Enum.map(fn(i) -> for z <- List.duplicate(i, n), do: IO.puts z end)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment