Created
August 17, 2019 09:49
-
-
Save OlukaDenis/60156117fc48b595633e7a4905be72fc to your computer and use it in GitHub Desktop.
A simplest method to solve Hackerrank stairCase problem.
This file contains 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
function stairCase(n){ | |
let arr = Array(n-1).fill(' ') | |
for (let i = n-1; i >= 0; i--) { | |
arr[i] = '#'; | |
console.log(arr.join('')); | |
} | |
} | |
stairCase(6) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it works