You are viewing a single comment's thread. Return to all comments →
def isValid(s): cnt = Counter(Counter(s).values()) val = list(cnt.keys()) if len(cnt) == 1 or (len(cnt) == 2 and ((abs(val[0] - val[1]) == 1 and 1 in cnt.values()) or cnt[1]==1)): return 'YES' return 'NO'
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and the Valid String
You are viewing a single comment's thread. Return to all comments →