Created
          January 2, 2019 12:51 
        
      - 
      
- 
        Save kharioki/9adfe229c5c3b6bfe709e0535aa532e6 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'; | |
| 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 staircase function below. | |
| function staircase(n) { | |
| let stair, space, hash; | |
| for (let i = 0; i < n; i++) { | |
| space = n - 1 - i; | |
| hash = i + 1; | |
| stair = ' '.repeat(space) + '#'.repeat(hash); | |
| console.log(stair); | |
| } | |
| } | |
| function main() { | |
| const n = parseInt(readLine(), 10); | |
| staircase(n); | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment