You are viewing a single comment's thread. Return to all comments →
Elixir Template A) Use when there isn't a special first line
defmodule Solution do def main() do IO.read(:stdio, :all) |> String.split # lines |> Enum.map(&String.to_integer(&1)) # integers |> Enum.reverse() # reversed integers # remember IO.inspect's default limit is 50! |> Enum.each(&IO.inspect(&1, limit: :infinity)) end end Solution.main()
Elixir Template B) Use when there is a special first line
defmodule Solution do def main() do lines = IO.read(:stdio, :all) |> String.split [first_line | rest_lines] = lines delimiter = String.to_integer(first_line) items = Enum.map(rest_lines, &String.to_integer(&1)) items |> Enum.filter(&(&1 < delimiter)) |> Enum.each(&IO.puts(&1)) end end Solution.main()
Solutions at https://youtube.com/landonwilkinscolor
Seems like cookies are disabled on this browser, please enable them to open this website
Solve Me First FP
You are viewing a single comment's thread. Return to all comments →
Elixir Template A) Use when there isn't a special first line
Elixir Template B) Use when there is a special first line
Solutions at https://youtube.com/landonwilkinscolor