You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This exercise will challenge users to implement a function that finds the most frequent number in an array. The goal is to identify the number that appears most often in the given array, handling various edge cases like multiple numbers with the same frequency, negative numbers, and an empty array.
Why Add This?
Helps learners practice array manipulation and iteration.
Teaches how to use data structures like objects or maps to track frequencies.
Introduces handling of edge cases such as empty arrays and multiple most frequent numbers.
Description:
This exercise will challenge users to implement a function that finds the most frequent number in an array. The goal is to identify the number that appears most often in the given array, handling various edge cases like multiple numbers with the same frequency, negative numbers, and an empty array.
Why Add This?
Test Cases:
mostFrequent([1, 2, 3, 4, 4, 5, 5, 5]); // ➞ 5
mostFrequent([7, 7, 8, 8, 9, 9, 9]); // ➞ 9
mostFrequent([]); // ➞ null (empty array)
If available, I would like to be assigned.
The text was updated successfully, but these errors were encountered: