Skip to content

Latest commit

 

History

History
9 lines (5 loc) · 411 Bytes

mode.md

File metadata and controls

9 lines (5 loc) · 411 Bytes

###Mode

Create a function simple_mode(array) take the array of numbers stored in array and return the number that appears most frequently (the mode).

For example: if array contains [10, 4, 5, 2, 4] the output should be 4.

If there is more than one mode return the one that appeared in the array first (ie. [5, 10, 10, 6, 5] should return 5 because it appeared first).

If there is no mode return -1.