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

TOP OF THREAD FULL DISCUSSION
re: WAIT. Here's a much cleaner solution in Ruby. def gossip_girl(string) string.downcase.count("x") == string.downcase.count("o") end Which re...
 

It turns out that you could avoid the #downcase with string.count("xX") == string.count("oO")

I don't know whether the performance would be significantly different, though it would avoid creating a couple of extra string instances.

There are some other interesting variations for #count, such as using it to count lower case letters with "abGvf".count("a-z")

code of conduct - report abuse