Skip to content

Instantly share code, notes, and snippets.

@Woodsphreaker
Created May 31, 2017 00:10
Show Gist options
  • Save Woodsphreaker/231492ac9fcccc570fe1b7261c9a0dc9 to your computer and use it in GitHub Desktop.
Save Woodsphreaker/231492ac9fcccc570fe1b7261c9a0dc9 to your computer and use it in GitHub Desktop.
Hacker Rank - Desafio Birthday Cake Candles
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