You are viewing a single comment's thread. Return to all comments →
def weightedUniformStrings(s, queries): result = [] weights_set = {ord(s[0])-96} j=1 for i in range(1,len(s)): if s[i]==s[i-1]: j+=1 else: j=1 weights = (ord(s[i])-96)*j weights_set.add(weights) for i in queries: result.append('Yes' if i in weights_set else 'No') return result
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 →