Given that integers are being read from a data stream. Find the mode of all the elements read so far starting from the first integer till the last integer.
Approach: The idea is to use a Hash-map to map elements to its frequency. While reading the elements one by one update the frequencies of elements in the map and also update the mode which will be the mode of the stream of the running integers.

#arrays #mathematical #array-stream #frequency-counting #java-hashmap

Mode in a Stream of Integers (Running Integers) - GeeksforGeeks
1.35 GEEK