Birthday Cake 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();
    

    }