Problem from Hackerrank.
My solution:
1 2 3 4 5 6 7 8 9 10 |
function main(n) { let space, hash, stair; for (var i = 0; i < n; i++){ space = n - 1 - i; hash = i + 1; stair = ' '.repeat(space) + '#'.repeat(hash); console.log(stair); } } |