We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
defisValid(s):# Write your code herea=Counter(s)set1=set(s)lst=sorted(list(a[p]forpinset1))lst1=list(i-lst[0]foriinlst)ifsum(lst1)==1orsum(lst1)==0orsum(lst1)==(len(lst1)-1)*lst1[-1]:return'YES'else:return'NO'
Cookie support is required to access HackerRank
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 →
PYTHON :