Skip to content
Onsite

Birthday Cake Candles

EasyP3Coding

Each element of candles is the height of a birthday candle. Only the tallest candles can be blown out. Return how many candles share the maximum height. For an empty array return 0.

Example 1

Input
candles = [4,4,1,3]
Output
2
Why
The tallest height is 4 and two candles have it.

Example 2

Input
candles = [3,2,1,3]
Output
2

Example 3

Input
candles = []
Output
0

Constraints

  • 0 <= candles.length <= 10^5
  • 1 <= candles[i] <= 10^7

Hints

Run checks the 3 visible tests, Submit all 10.