Birthday Cake Candles

  • + 0 comments

    Solved using PHP: Time complexity : O(n)

    `$length = count($`candles); 
    `$maxHeight = max($`candles);  
    $candles_count = 0;
    
    for( `$i = 0; $`i < `$length; $`i++ ){
        if( `$candles[$`i] == $maxHeight ){
            $candles_count += 1;
        }
    }
    
    
    return $candles_count