You are viewing a single comment's thread. Return to all comments →
def weightedUniformStrings(s, queries): a = string.ascii_lowercase w = [] ls = len(s) i = 0 while i < ls: c = s[i] w0 = a.index(c)+1 w1 = w0 w.append(w1) while i < ls - 1: if s[i+1] == c: w1 += w0 w.append(w1) i += 1 else: break i += 1 w = set(w) l = [] for i in queries: if i in w: l.append('Yes') else: l.append('No') return l
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 →