Birthday Cake Candles

  • + 0 comments

    My solution on Python: def birthdayCakeCandles(candles): candles.sort() c = sum(1 for i in candles if candles[-1] == i) return c

    it sum +1 if the element i has the same value has the last element on the sorted list (highest value) so it returns the count of the elements with the highest value (tallest candle)