about | help | code help+videos | done | prefs |
Given an array of integers - search through the array for the "mode" - the most frequently occurring value in the array. It is possible that there are multiple modes, just return the first mode number. Example 1,5,3,6,4,3,1,3,5,8,5,2,5,12 - returns 5 (which occurs 4 times). If the array is empty return zero. findMode([5, 2, 5, 2, 5, 2, 2, 5, 5, 5, 2, 1, 5]) → 5 findMode([1, 2, 2, 2, 5, 1]) → 2 findMode([1, 2, 3, 1, 1, 6, 7]) → 1 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 120
Copyright Nick Parlante 2017 - privacy