Vote count:
0
I know there are similar questions like this one. But here's a trick. Let's assume that we have this array:
int[] list = {1, 2, 3, 1, 0, 0, 0, 5, 6, 1569, 1, 2, 3, 2, 1569, 3};
System.out.println("Most repeated value is: " + ???);
/* Now As you can see 0's, 1's, 2's and 3's has the same frequency "3 times". In this case,
I need to print the smallest number which is the most frequently repeated. So that,
prompt should be 0 */
To make it more understandable:
// All the digits except 5 and 6 and 1569's rest of the values repeated 3 times. I have to
// print the smallest number which occurs most.
If you could help code wise in java I would very appreciate it. Thanks for checking.
asked 35 secs ago
How to find the most frequently repeated number in Array?
Aucun commentaire:
Enregistrer un commentaire