Step-by-step solution for Mean Mode
View the challenge

This challenge requires you to determine if the mean is equal to the mode of an array. The mean is the average of the array, in other words, all the numbers added up and divided by the number of elements. The mode is the element that appears most often in the array. For example, if the array were [5, 3, 3, 3, 1] your program should return 1 because the mean is 3 and the mode is 3. If they are not equal your program should return 0. To solve this we'll calculate the mean and mode separately by looping through the array, and then compare the answers. To calculate the mode we'll use a data structure similar to the one we created in a previous challenge.

You need to be a member to see the rest of this solution and code.