// Complete the staircase function below.
function staircase(n) {
for (let i = 0; i < n; i++) {
for (let j = 0; j < n - i - 1; j++) {
process.stdout.write(" ")
}
for (let k = 0; k < i + 1; k++) {
process.stdout.write("#")
}
process.stdout.write("\n")
}
}
Staircase
November 18, 2019 • ☕️ 1 min read
algorithm/hackerrank