You are viewing a single comment's thread. Return to all comments →
def freqQuery(queries): data = dict() ans = list() for query in queries: op = query[0] value = query[1] if op == 1: data[value] = data.get(value, 0) + 1 elif op == 2: if data.get(value, 0) > 0: data[value] -= 1 elif op == 3: for v in data.values(): if v == value: ans.append(1) break else: ans.append(0) return ans
Seems like cookies are disabled on this browser, please enable them to open this website
Frequency Queries
You are viewing a single comment's thread. Return to all comments →