Birthday Cake Candles

Sort by

recency

|

5260 Discussions

|

  • + 0 comments
    def birthdayCakeCandles(candles: list) -> int:
        ma = max(candles)
        return len(list(filter(lambda x: x == ma, candles)))
    
  • + 0 comments

    C++ Solution

    int birthdayCakeCandles(vector candles) {

    auto max = max_element(candles.begin(), candles.end());
    auto iter{ std::remove_if(candles.begin(), candles.end(), [&max](int i){
        return i != *max;
    }) };
    
    candles.erase(iter, candles.end());
    
    return candles.size();
    

    }

  • + 0 comments

    If we respect the first constaint test 6 fails.

    var filteredCandles = candles.Where(candle => candle >= 1 && candle <= Math.Pow(10, 5)).ToArray();

    I think there is an error in test cases

  • + 0 comments

    start to creat the birth day canndle and enjoy birth day with this movie site . https://ibommatelugum.com/

  • + 0 comments

    Here is my c++ solution, you can watch the video explanation here : https://youtu.be/zcWbM-aaopc

    #include <bits/stdc++.h>
    
    using namespace std;
     
    int main (){
        int s;
        cin >> s;
        vector<int> arr(s);
        for(int i = 0; i < s; i++){
            cin >> arr[i];
        }
        cout << count(arr.begin(), arr.end(), *max_element(arr.begin(), arr.end()));    
        return 0;
    }