Birthday Cake Candles

  • + 1 comment
    #C++ Solution In One LOOP
        int n =candles.size(),max_till=INT64_MIN,count=0;
    for(int i =0; i<n; i++){
        if (max_till<candles[i]) {
            max_till=candles[i];
            count=0;
        }
        if (max_till==candles[i]) {
            count++;
        }
    }
    return count;