// Complete the birthdayCakeCandles function below.
function birthdayCakeCandles(ar) {
let max = Number.MIN_SAFE_INTEGER
let cnt = 0
ar.forEach(n => {
if (max < n) {
max = n
cnt = 0
}
if (max === n) {
cnt++
}
})
return cnt
}
Birthday Cake Candles
November 20, 2019 • ☕️ 1 min read
algorithm/hackerrank