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

FULL DISCUSSION
 

Ruby

def xo(str)
  tally = 0
  str.each_char do |c|
    case c.upcase
    when "X" then tally += 1
    when "O" then tally -= 1
    end
  end
  tally.zero?
end

Shorter solutions, but this only loops through the string once which might be nice for enormous strings.

code of conduct - report abuse