Course · Section 11: Working With Arrays · Lecture 156: Data Transformations: map, filter, reduce
Implement `mostFrequent(arr)` returning the element that appears most often. On a tie, return the one that reaches the highest count first.
+ 1 hidden test run on Submit.
Counting while scanning and updating the best only on a strictly higher count returns the element that first reaches the maximum frequency.
Run your code to see results.