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.
- Prepare
- Algorithms
- Warmup
- Birthday Cake Candles
- Discussions
Birthday Cake Candles
Birthday Cake Candles
Sort by
recency
|
5233 Discussions
|
Please Login in order to post a comment
Python
return candles.count(max(candles))
Golang
Here is my c++ solution, you can watch the video explanation here : https://youtu.be/zcWbM-aaopc
C# or csharp solution: public static int birthdayCakeCandles(List candles) { int max = candles.Max(); int count = 0;
I'm thinking it would be O(2n) - since candles.Max() presumably is looping through the array once and then my foreach loop will iterate through the array once more.