You are viewing a single comment's thread. Return to all comments →
def stringReduction(s): str=s n = len(str) count = [0] * 3 for i in range(n): count[ord(str[i]) - ord('a')] += 1 if (count[0] == n or count[1] == n or count[2] == n): return n if ((count[0] % 2) == (count[1] % 2) and (count[1] % 2) == (count[2] % 2)): return 2 return 1
Seems like cookies are disabled on this browser, please enable them to open this website
String Reduction
You are viewing a single comment's thread. Return to all comments →