re: Daily Challenge #17 - Double Trouble VIEW POST

FULL DISCUSSION
 

Elixir:

defmodule DoubleCola do
  def nth_drinker([head | tail], 1), do: head

  def nth_drinker([head | tail], n)
      when n > 1,
      do: nth_drinker_recursive(tail ++ [head, head], n - 1)
end
code of conduct - report abuse