I really enjoy doing these problems in Elixir, but the fact that the default collection type is a linked list makes certain problems difficult. However, Erlang does have a fifo queue (a doubly linked list), which can be helpful and let's you practice some Erlang interop while you're at it. https://www.erlang.org/doc/man/queue.html