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.
- Prepare
- Algorithms
- Warmup
- Staircase
- Discussions
Staircase
Staircase
Sort by
recency
|
4974 Discussions
|
Please Login in order to post a comment
Here is my c++ implementation, you can watch the video here : https://youtu.be/4yntFcMY30U
JAVA Program
C++
my solution:
Javascript solution
function printPattern(outPut, limit, item) { for (let i = 1; i <= limit; i++) { outPut += item; } return outPut; }
function staircase(n) { for (let i = 1; i <= n; i++) { let space = n - i; let outPut = ""; outPut = printPattern(outPut, space, " "); outPut = printPattern(outPut, i, "#"); console.log(outPut); } }