+ 8

*DAILY CHALLENGE* : write a code that gets as input a positive number n > 1 and prints n rows from "3-SUM-TRIANGLE".

This is the 3-SUM-TRIANGLE for n = 7: 1 1 1 1 3 1 1 5 9 1 1 7 21 31 1 1 9 37 89 121 1 1 1 1 1 1 1 1 EXAMPLE n = 4: 1 1 1 1 3 1 1 1 1 1 - line 1 & 2 are always fix. - Each number equals the sum of its left,top & top-left neighbour (if all 3 exist!!!). - the n'th row is allways filled with '1' GOOD LUCK AND HAVE FUN CODERS !!! I'LL UPLOAD MY RESULT IN 12h. https://code.sololearn.com/cUbW5uvww5zB/?ref=app

15th Aug 2017, 8:11 PM
Julian Fechner
Julian Fechner - avatar
32 Answers
+ 2
https://code.sololearn.com/cZVCYwdHo10E/?ref=app
16th Aug 2017, 3:38 PM
MKR
MKR - avatar
+ 9
First Try ver 2 - think the formatting looks better now https://code.sololearn.com/c6xFULnU5s8h/#py
15th Aug 2017, 10:24 PM
Louis
Louis - avatar
+ 7
I don,t know what happened to Julian. I missed the next challenge so much, I designed my own challenge I am sure you will find it challenging. https://www.sololearn.com/Discuss/633313/friday-challenge-write-a-code-that-gets-as-input-a-positive-number-n-1-and-prints-a-n-x-n-clockwise
18th Aug 2017, 12:58 AM
Louis
Louis - avatar
+ 6
can we run the code submissions to test everyone's solving submissions and theory? I'm curious as to the results of these answers...🤔
15th Aug 2017, 10:49 PM
Linda Dawkins
Linda Dawkins - avatar
+ 6
Antoine Bergerault, looks like you've got the answer...
15th Aug 2017, 10:51 PM
Linda Dawkins
Linda Dawkins - avatar
+ 4
I'll take a pause to think about. here my thought: https://code.sololearn.com/WC7P8zy046yL/?ref=app nice challenge again, congrats 👍
15th Aug 2017, 8:30 PM
ysraelcon
ysraelcon - avatar
+ 4
Thanks for posting these Julian! https://code.sololearn.com/chPSxv02Ul8z/?ref=app
15th Aug 2017, 8:44 PM
Ready
Ready - avatar
+ 3
https://code.sololearn.com/ct4T7JafE8Ho/?ref=app
15th Aug 2017, 8:35 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
15th Aug 2017, 9:30 PM
Αητοιπe
Αητοιπe - avatar
+ 3
Here's my try (best results on the web playground): https://code.sololearn.com/cX1xZA7f8hS3/?ref=app
16th Aug 2017, 8:42 AM
Garikai
Garikai - avatar
+ 3
17th Aug 2017, 11:09 AM
wolfsan
wolfsan - avatar
+ 3
https://code.sololearn.com/ccR43nePODYq/?ref=app
25th Aug 2017, 4:26 AM
hamletmun
hamletmun - avatar
+ 2
Here is my attempt: https://code.sololearn.com/chlV2SIO6q4V The user inputs a positive integer and then receives the triangle whith the columns flush right, relative to themselves.
15th Aug 2017, 9:55 PM
janKalupana
janKalupana - avatar
+ 2
thank you for the challenge. Ideas to formatting the Output are welcome, I tried tabs they won't do anything. https://code.sololearn.com/cbPuR9xWkV0e/?ref=app
15th Aug 2017, 10:03 PM
Matthias W
+ 2
@MatthiasW - What I tried (which only works with monospaced fonts) is to find the biggest number per column and then add spaces based on the difference in number of digits between what you're currently outputting. Of course, this requires you to calculate all of the values in the triangle before outputting anything.
15th Aug 2017, 10:08 PM
janKalupana
janKalupana - avatar
+ 2
@Jan thank you for the suggestion it looks much nicer that way. And luckily doesn't look overly complicated in Code, the triangle was created before printing anyway.
15th Aug 2017, 10:20 PM
Matthias W
+ 2
Here is my version, the simplest I could: Great task, btw! https://code.sololearn.com/c1ODo4NS4255/?ref=app
16th Aug 2017, 12:53 PM
Pavle Mutic
Pavle Mutic - avatar
+ 2
https://code.sololearn.com/c2fPIq6b4fqL/?ref=app
18th Aug 2017, 7:51 AM
Jose Thomas
Jose Thomas - avatar
15th Aug 2017, 11:51 PM
André
André - avatar
+ 1
https://code.sololearn.com/cxRy3St7ZkmP/?ref=app
16th Aug 2017, 7:39 AM
hmysjiang🍀
hmysjiang🍀 - avatar