You are viewing a single comment's thread. Return to all comments →
No need to iterate over the array twice
int count = 0; int max = 0; for(int i=0; i< ar.length; i++){ if(ar[i] == max){ count = count + 1; } if(ar[i] > max){ max = ar[i]; count = 1; } } return count;
Seems like cookies are disabled on this browser, please enable them to open this website
Birthday Cake Candles
You are viewing a single comment's thread. Return to all comments →
No need to iterate over the array twice