You are viewing a single comment's thread. Return to all comments →
int birthdayCakeCandles(vector<int> candles) { set<int> unique_nums(candles.begin(), candles.end()); int max_val = *max_element(unique_nums.begin(), unique_nums.end()); int count1 = count(candles.begin(), candles.end(), max_val); return count1; }
Created OrderedTreeSet to remove the duplicates then find the max element from the set, then find the count of occourence in the provided list.
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 →
Created OrderedTreeSet to remove the duplicates then find the max element from the set, then find the count of occourence in the provided list.