Created
May 31, 2017 00:10
-
-
Save Woodsphreaker/231492ac9fcccc570fe1b7261c9a0dc9 to your computer and use it in GitHub Desktop.
Hacker Rank - Desafio Birthday Cake Candles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
process.stdin.resume(); | |
process.stdin.setEncoding('ascii'); | |
var input_stdin = ""; | |
var input_stdin_array = ""; | |
var input_currentline = 0; | |
process.stdin.on('data', function (data) { | |
input_stdin += data; | |
}); | |
process.stdin.on('end', function () { | |
input_stdin_array = input_stdin.split("\n"); | |
main(); | |
}); | |
function readLine() { | |
return input_stdin_array[input_currentline++]; | |
} | |
/////////////// ignore above this line //////////////////// | |
function main() { | |
var n = parseInt(readLine()); | |
height = readLine().split(' '); | |
height = height.map(Number); | |
const maxCandles = Math.max(...height) | |
const candles = height.filter(candle => candle === maxCandles) | |
const solve = candles.length | |
console.log(solve) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment