We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
#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;
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Birthday Cake Candles
You are viewing a single comment's thread. Return to all comments →