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.
defweightedUniformStrings(s,queries):# Write your code heren=set()c=0repeat_multiplier=1whilec<len(s):ifc>0ands[c-1]==s[c]:repeat_multiplier+=1else:repeat_multiplier=1weight=(ord(s[c])-96)*repeat_multipliern.add(weight)c+=1result=[]foriinqueries:ifiinn:result.append("Yes")else:result.append("No")returnresult
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Weighted Uniform Strings
You are viewing a single comment's thread. Return to all comments →