You are viewing a single comment's thread. Return to all comments →
Hi :) My solution in Python 3:
def isValid(s): chars_occurs = [s.count(c) for c in set(s)] min_freq = min(chars_occurs) if len(s) - min_freq * len(chars_occurs) <= 1: return 'YES' max_freq = max(chars_occurs) if max_freq * len(chars_occurs) - len(s) == max_freq - 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 →
Hi :) My solution in Python 3: