--DAY 2--
Hi, I am going to make #100DaysOfCode Challenge.Everyday I will try solve 1 problem from leetcode or hackerrank. Hope you can go with me until end.
This is 2nd day:
-Problem: Staircase
-Detail: https://www.hackerrank.com/challenges/staircase/problem
-My solution (javascript):
function staircase(n) {
let line=[];
line.length=n;
line.fill(' ');
for(let i=0;i<n;i++){
line.shift();
line.push('#');
console.log(line.join(''));
}
}
--> If you have better solution or any question, please comment below. I will appreciate.
Top comments (0)