Birthday Cake Candles

  • + 0 comments

    Here is my solution for Java 8.

    public static int birthdayCakeCandles(List<Integer> candles) {
            // Write your code here
            long max = 0;
            int count = 0;
            for(int val: candles)
            {
                if(max < val){
                    max = val;
                    count = 1;
                } else if (max == val){
                    count++;
                }  
            }
            return count;
        }