Birthday Cake Candles

Sort by

recency

|

5378 Discussions

|

  • + 0 comments

    def birthdayCakeCandles(candles): return candles.count(max(candles))

  • + 0 comments

    For Python3 Platform

    def birthdayCakeCandles(candles):
        return candles.count(max(candles))
    
    n = int(input())
    candles = list(map(int, input().split()))
    
    result = birthdayCakeCandles(candles)
    
    print(result)
    
  • + 0 comments

    Typescript Solution

    function birthdayCakeCandles(candles: number[]): number {
        // Write your code here
        let largest_candle_count:number=0;
        let largest_candle=Math.max(...candles);
        for(let i=0;i<candles.length;i++){
            if(candles[i]==largest_candle){
                largest_candle_count++;
            }
        }    
        return largest_candle_count
    }
    
  • + 0 comments

    Java Solution

        public static int birthdayCakeCandles(List<Integer> candles) {
        // Write your code here
            HashMap<Integer,Integer> maps = new HashMap<>();
            for(int num : candles){
                if(maps.containsKey(num)){
                    maps.put(num, maps.get(num)+1);
                }
                else {    
                maps.put(num, 1);
                }
            }
            int maxEle = maxing(candles);
            return maps.get(maxEle);
            
        }
        public static int maxing (List<Integer> arr){
            int max = arr.get(0) ;
            for(int i = 0 ; i<arr.size(); i++){
                if(max < arr.get(i)){
                    max=arr.get(i);
                }
            }
            return max;
        }
    
  • + 0 comments

    Selby locksmith highlights the charm of birthday cake candles, a timeless tradition that adds joy and sparkle to celebrations. Available in various colors, shapes, and themes, candles make every cake unique and memorable. From classic single flames to fun sparkler styles, they symbolize wishes and happiness. Blowing them out is a cherished ritual that brings family and friends together. Birthday cake candles remain an essential detail for making special moments truly unforgettable.