id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

andersoniii.edwin@cusd80.com > findMode
prev  |  next  |  chance

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)

public int findMode(int[] nums) }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 120

Copyright Nick Parlante 2017 - privacy