Question
Java Question : frequencyCount takes in an array of integer values that must be from 0 to 9. You can assume the values are in
Java Question: frequencyCount takes in an array of integer values that must be from 0 to 9. You can assume the values are in that range. The method produces a new array of 10 integers. The value at index 0 is the number of times 0 appears in the elements of the array parameter. The value at index 1 is the number of times 1 appears in the elements of the array parameter - and so on up to index 9.
Parameter arr: An array of integers. The integers must only be valued 0-9. The array can be length 0.
Returns an array of size 10 holding the counts for each digit in the parameter array. If we call frequencyCount([0,0,1,1,1,7]), then it would return [2,3,0,0,0,0,0,1,0,0] since there are 2 zeroes and 3 ones and 1 seven, and no other digits.
public static int[] frequencyCount (int[] arr) {
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started