You are viewing a single comment's thread. Return to all comments →
Python3
str_weights = set() curr = ("", 0) for l in s: curr = (l, (curr[1] if l == curr[0] else 0) + ord(l) - 96) str_weights.add(curr[1]) return ['Yes' if q in str_weights else 'No' for q in queries]
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 →
Python3