from collections import defaultdict
counts = defaultdict(int)
len(counts)
for key in counts:
counts = {}
counts.get(key, 0 /* default value */)
dictionary.values() doesn't actually return a list, but actually a view object. We need to convert it to a list first.
dict is HashMap in Python - uses open addressing. key needs to be immutable.
sliding window is for max and prefix sum hash map is for counting.
any random access is O(1) add, remove, update, find.