I have an array with repeating values:
[0, 1, 6, 0, 1, 0]
What is an efficient way to return the highest amount that a specific value repeats?
In the example array I would want the script to return 3 because the number 0 repeats the most often and it repeats 3 times.
I’m already using jQuery and Underscore.
This is similar to the basic approach, but utilizes underscore’s
reduceandmaxfunctions. If you had a really really really large array, I hope it’s clear how you could parallelize this with a map phase before the reduce.