Created
          January 2, 2019 12:50 
        
      - 
      
- 
        Save kharioki/bd3b6ebb76f0bbf3ff851280243abc54 to your computer and use it in GitHub Desktop. 
  
    
      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
    
  
  
    
  | 'use strict'; | |
| const fs = require('fs'); | |
| process.stdin.resume(); | |
| process.stdin.setEncoding('utf-8'); | |
| let inputString = ''; | |
| let currentLine = 0; | |
| process.stdin.on('data', inputStdin => { | |
| inputString += inputStdin; | |
| }); | |
| process.stdin.on('end', _ => { | |
| inputString = inputString.replace(/\s*$/, '') | |
| .split('\n') | |
| .map(str => str.replace(/\s*$/, '')); | |
| main(); | |
| }); | |
| function readLine() { | |
| return inputString[currentLine++]; | |
| } | |
| // Complete the birthdayCakeCandles function below. | |
| function birthdayCakeCandles(ar) { | |
| const max = Math.max(...ar); | |
| return ar.filter(x => x === max).length; | |
| } | |
| function main() { | |
| const ws = fs.createWriteStream(process.env.OUTPUT_PATH); | |
| const arCount = parseInt(readLine(), 10); | |
| const ar = readLine().split(' ').map(arTemp => parseInt(arTemp, 10)); | |
| let result = birthdayCakeCandles(ar); | |
| ws.write(result + "\n"); | |
| ws.end(); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment