Problem 2671 · Medium
Keep each value’s count and a count-of-counts table so that every add, delete and frequency query is constant time.
Open the interactive visualisation