Kotlinlearncs.online LogoJava
Return to List

Solve: Find Most Frequent 0-99

Created By: Justin Maier
/ Version: 2025.11.1

Complete the method findMostFrequent that takes an array containing ints in the range 0 through 99 (inclusive) and returns the value that occurs the most in the array. If there is a tie for the most frequent value, return the largest of the tied values.

If the passed array is null or empty, throw an `IllegalArgumentException`.

int findMostFrequent(int[] values) {
return 0; // You may need to remove this starter code
}

Related Lessons

Stuck? You may find these lessons helpful: