We have a service in production that is receiving a lot of traffic. We get a few spikes in traffic from a few users that is Dosing our service (causing severe degradation). How would we deal with this?
We want to find the mode of this sequence, which takes O(n) time and O(n) space.
(Let’s say this is too expensive).
We can find the elements that occur at least n% of the time in O(1/n) memory.
This can be generalized for any percentage from 0-100. (X = 1 / k)
We can do this by having k - 1 current winners + counters.