re: Daily Challenge #29 - Xs and Os VIEW POST

FULL DISCUSSION
 

Elixir:

defmodule XO do
  def same(string),
    do: count(string, "x") == count(string, "o")

  defp count(string, letter) do
    string
    |> String.graphemes()
    |> Enum.filter(&(&1 == letter))
    |> Enum.count()
  end
end
code of conduct - report abuse