Welcome to my first post ever on this platform! š
I'm stuck on a problem and can't seem to figure it out. Here's the link to the challenge: .
Most of my tests are passing, except for the last one.
Another user posted a similar question but with a different approach, and they're facing the same issue with the test case. Here's the link to their question: Birthday cake candles- hackerrank.
Below is the code I'm currently using:
function birthdayCakeCandles(ar) {
ar = ar.sort();
let high = [];
for(let i = 0; i < ar.length; i++){
if (ar[i] === ar[ar.length -1]){
high.push(ar[i]);
}
}
return high.length;
}
Would really appreciate any help or suggestions. Thank you! š