Birthday Cake Candles

  • + 0 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.