just need a bit help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

just need a bit help

here is my attempt https://code.sololearn.com/cxUHm6ilvdFJ/?ref=app I want the exact pattern that has given me to print unfortunately I'm unable to make. so if you can help me in making logic of it so please help. i want this pattern // * // * * // * * * // * * * * // * * * * // * * * * * but I'm getting it horizontally.

7th Nov 2022, 4:35 PM
Davinder Kumar
Davinder Kumar - avatar
4 Answers
+ 4
Find formula.observe carefully.. you can : * find max value from array. * use 2 loops, outer loop, From row=0 to max : Repeat inner loop from o to arr.length If row+array_value>=max print "*" else space. or add to 2d matrix then print left rotated matrix
7th Nov 2022, 6:18 PM
Jayakrishna 🇮🇳
+ 2
Instead of printing "*" to the console, place it into a matrix at an equivalent X/Y position. After loop completes print the matrix, but transposed.
7th Nov 2022, 5:53 PM
Brian
Brian - avatar
+ 1
Davinder Kumar Instead of printing during the loop, write the characters into a two-dimensional array. Then you can print from the array in a transposed order.
7th Nov 2022, 4:45 PM
Brian
Brian - avatar
+ 1
Brian what characters are you talking about ?
7th Nov 2022, 5:12 PM
Davinder Kumar
Davinder Kumar - avatar