We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
function main() {
var n = parseInt(readLine());
var symbol = "#";
var output = new Array(n+1).join(' ').split('');
for(var i = 1; i <= n; i++){
output.shift();
output.push(symbol);
console.log(output.join(''));
}
}
Staircase
You are viewing a single comment's thread. Return to all comments →
This is mine.
Could have used substring instead of an array as shown in http://stackoverflow.com/a/5366862/276681
pad.substring(' ', pad.length - str.length) + str