How about some ugly oneliner?
Which produces the following output:
XO("ooxx"); // true
XO("xooxx"); // false
XO("ooxXm"); // true
XO("zpzpzpp"); // true
XO("zzoo"); // false
It basically works by lowercasing everything and building an array with the number of Xs and Os. After that, it builds a Set with it, and check if the Set size is 1 or 2!
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.