You are viewing a single comment's thread. Return to all comments →
l = [s.count('a'),s.count('b'),s.count('c')) while(l.count(0)<2): l.sort(reverse=True) l[0]-=1 l[1] -= 1 l[2] += 1 return max(l)
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 →
l = [s.count('a'),s.count('b'),s.count('c')) while(l.count(0)<2): l.sort(reverse=True) l[0]-=1 l[1] -= 1 l[2] += 1 return max(l)