Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
October 20, 2021 12:36 am GMT

code every day with me

--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.


Original Link: https://dev.to/coderduck/code-every-day-with-me-3fob

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To