You are viewing a single comment's thread. Return to all comments →
public static int birthdayCakeCandles(List<Integer> candles) { int maximum = 0; int numberOfMaximums = 0; for(int i = 0; i < candles.size(); i++) { int height = candles.get(i); if (maximum < height) { maximum = height; numberOfMaximums = 0; } if (maximum == height) { numberOfMaximums += 1; } } return numberOfMaximums; }
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 →