1 1 1 1 5 5 5 5 5 this is a case where your code may fail. Check and update the max occurance variable outside the loop too. Above case give enough justice to my point, i hope.
More Related Contents:
- JAVA ArrayIndexoutofBoundException issue
- Write a program that takes an array/arraylist of integer and finds longest sub array/arraylist whose entries are equal [closed]
- How to add two int array values together?
- Finding index of array of 2nd occurring element
- Create ArrayList from array
- Why does the toString method in java not seem to work for an array
- How to Parse JSON Array with Gson
- Generic arrays in Java
- How can I check whether an array is null / empty?
- How to initialize an array of objects in Java
- Problem with assigning an array to other array in Java
- comparing arrays in java
- Sorting 2D array of strings in Java
- Find the most popular element in int[] array
- How does the Java array argument declaration syntax “…” work?
- Write a mode method in Java to find the most frequently occurring element in an array
- How to clone a multidimensional array in java? [duplicate]
- java – passing array in oracle stored procedure
- How to access nested elements of json object using getJSONArray method
- Why can I edit the contents of a final array in Java?
- How to manipulate arrays. Find the average. Beginner Java
- How to find the only number in an array that doesn’t occur twice [duplicate]
- How to deep copy an irregular 2D array
- java: Arrays.sort() with lambda expression
- Java ArrayList how to add elements at the beginning
- Printing out a 2D array in matrix format
- Array of function pointers in Java [duplicate]
- Why does array indexing in Java start with 0?
- How to convert a Java String to an ASCII byte array?
- Converting an int array to a String array