Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Add New Exercise - "Most Frequent Number in an Array" #529

Open
briz123 opened this issue Mar 8, 2025 · 0 comments
Open

Proposal: Add New Exercise - "Most Frequent Number in an Array" #529

briz123 opened this issue Mar 8, 2025 · 0 comments

Comments

@briz123
Copy link

briz123 commented Mar 8, 2025

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?

  • 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.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant