You are viewing a single comment's thread. Return to all comments →
Here's Elixir implementation
defmodule Solution do def times(n, element) do if (n > 1) do IO.puts element times(n-1, element) else IO.puts element end end def elements(array) do [_ | rest ] = array Enum.map(rest, fn(x) -> times(List.first(array), x) end) end def main() do IO.read(:stdio, :all) |> String.split |> Enum.map(&String.to_integer(&1)) |> elements end end Solution.main
Seems like cookies are disabled on this browser, please enable them to open this website
List Replication
You are viewing a single comment's thread. Return to all comments →
Here's Elixir implementation