DEV Community


Discussion on: Daily Challenge #29 - Xs and Os

databasesponge profile image
MetaDave 🇪🇺

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")