+ 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
32 odpowiedzi
+ 2
https://code.sololearn.com/cZVCYwdHo10E/?ref=app
+ 9
First Try ver 2 - think the formatting looks better now
https://code.sololearn.com/c6xFULnU5s8h/#py
+ 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
+ 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...🤔
+ 6
Antoine Bergerault, looks like you've got the answer...
+ 4
I'll take a pause to think about.
here my thought: https://code.sololearn.com/WC7P8zy046yL/?ref=app
nice challenge again, congrats 👍
+ 4
Thanks for posting these Julian!
https://code.sololearn.com/chPSxv02Ul8z/?ref=app
+ 3
https://code.sololearn.com/ct4T7JafE8Ho/?ref=app
+ 3
Here's my try (best results on the web playground):
https://code.sololearn.com/cX1xZA7f8hS3/?ref=app
+ 3
My Solution for this challenge
https://code.sololearn.com/cYBm2xyKvHat/?ref=app
+ 3
https://code.sololearn.com/ccR43nePODYq/?ref=app
+ 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.
+ 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
+ 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.
+ 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.
+ 2
Here is my version, the simplest I could:
Great task, btw!
https://code.sololearn.com/c1ODo4NS4255/?ref=app
+ 2
https://code.sololearn.com/c2fPIq6b4fqL/?ref=app
+ 1
My response in Ruby:
https://code.sololearn.com/cXcdx8mHqFwt/?ref=app
+ 1
https://code.sololearn.com/cxRy3St7ZkmP/?ref=app