You are viewing a single comment's thread. Return to all comments →
def freqQuery(queries): freq_map = {} result = [] for query in queries: operation, element = query if operation == 1: freq_map.setdefault(element, 0) freq_map[element] += 1 elif operation == 2 and freq_map.get(element): freq_map[element] -= 1 elif operation == 3: matched = element in freq_map.values() result.append(1) if matched else result.append(0) return result
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 →