🏆********CHALLENGE *********🏆 Create a recursive function that draws the following pattern. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 21

🏆********CHALLENGE *********🏆 Create a recursive function that draws the following pattern.

Create a recursive function called star that accepts an odd integer that draws the following pattern. Example: when called as star(9). \ | / \ | / \ | / \|/ --------- /|\ / | \ / | \ / | \ The display above is not accurate. what you are looking at us a 9x9 square. Enjoy your recursion. Its been 24 Hours, so here is my solution. It is not the best. I am really impressed with all the submisions. https://code.sololearn.com/c36iwbByGB8n/?ref=app

26th Nov 2017, 6:21 AM
Louis
Louis - avatar
18 Answers
+ 11
1st version===non recursive 2nd version===recursive(no input needed) 3rd version===one-liner recursive(no input needed) https://code.sololearn.com/cjAi8SIVr2GR/?ref=app https://code.sololearn.com/cn1WGKcp2W2e/?ref=app https://code.sololearn.com/c8fS5vDDacgm/?ref=app
26th Nov 2017, 8:15 AM
sayan chandra
sayan chandra - avatar
26th Nov 2017, 9:43 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 11
Thanks for all the submisions. I have learned something from each of you. See my code in the question above. Choosng a winner was difficult, so please accept my decision. 1. Sayan Chandra (Masterfull) https://code.sololearn.com/c8fS5vDDacgm/?ref=app 2. Christian Stollberg. (made me think the most) https://code.sololearn.com/cp7a0taVoOeu/?ref=app 3. Hiroki Masuda ( Only Ruby entry and nifty execution) https://code.sololearn.com/chEXGPoBl10J/?ref=app 4. Edgars Urbans ( Only Cpp recursion) https://code.sololearn.com/c16C8IMWa9We/?ref=app 5. Gordie (Java) https://code.sololearn.com/cHLAn50lbqtD
28th Nov 2017, 1:16 AM
Louis
Louis - avatar
+ 10
@Sayan, you are the oneline master.
26th Nov 2017, 9:18 AM
Louis
Louis - avatar
26th Nov 2017, 12:39 PM
David Akhihiero
David Akhihiero - avatar
+ 7
bookmarking
26th Nov 2017, 11:33 AM
David Akhihiero
David Akhihiero - avatar
+ 5
Recursive and parameterized, as requested: https://code.sololearn.com/cp7a0taVoOeu/
26th Nov 2017, 9:35 AM
Cristian Stollberg
Cristian Stollberg - avatar
26th Nov 2017, 11:09 AM
Tim Thuma
Tim Thuma - avatar
+ 5
Thanks for this great challenge. Using recursive call with only one argument was difficult. https://code.sololearn.com/chEXGPoBl10J/?ref=app
27th Nov 2017, 12:13 AM
Hiroki Masuda
Hiroki Masuda - avatar
26th Nov 2017, 4:49 PM
Kartik
Kartik - avatar
+ 3
Much appreciate for getting me through the concept of recursion! And.. as always.. Thanks for the challenge! https://code.sololearn.com/c16C8IMWa9We/?ref=app
26th Nov 2017, 9:13 PM
Edgars Urbans
Edgars Urbans - avatar
+ 2
😀😀no brother just a newbie..my dear friend @Vcc deserves the crown.. i admire him very much...
26th Nov 2017, 9:19 AM
sayan chandra
sayan chandra - avatar
+ 2
Just report this person 😤
26th Nov 2017, 7:50 PM
Kartik
Kartik - avatar
+ 2
@Ahha What are you even trying to get by doing this?
26th Nov 2017, 7:53 PM
Kartik
Kartik - avatar
27th Nov 2017, 4:18 AM
Lindsay Linjie Chen
Lindsay Linjie Chen - avatar
+ 1
@ louis i added 3 posts together...in my 1st post...
26th Nov 2017, 9:23 AM
sayan chandra
sayan chandra - avatar
+ 1
Holy!!! No spam
26th Nov 2017, 8:08 PM
Singraft
Singraft - avatar