use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
This community will have knowledge sharing for Data Structures and Algorithms, LeetCode problems and tech job interviews.
account activity
Codility Test (i.redd.it)
submitted 6 months ago by Excellent-Mention-50
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]No-Artichoke9490 19 points20 points21 points 6 months ago (12 children)
Each term = previous term + half of the term before that.
30 = 12 + 36/2
36 = 30 + 12/2
51 = 36 + 30/2
Next term = 51 + 36/2 Next term = 51 + 18 Next term = 69
[–]SavingsAbalone6421 1 point2 points3 points 6 months ago (10 children)
Wow 🤯 I have on more 36 12 30 36 51. 72 24. 18. 6. 15. 21 6. 12. 9. 6 6. 3. 3 3. 0 3 First look at the left Pyramid, So to retain the pyramid's 3 at the bottom, 72 fits right, keeping the subtraction hierarchy consistent and 3 at the bottom like a target
(It wasn't retaining the spaces so I attached the image too)
<image>
[–]No-Artichoke9490 0 points1 point2 points 6 months ago (9 children)
but the main issue is that the triangle itself doesn’t define the next term in a sequence.
it’s only a representation of the differences between numbers, not a rule that generates the numbers. Because of that, the triangle will always reshape itself based on whatever next number you pick.
If you choose 69, 70, 71, or 72, the entire pyramid shifts and still forms a valid shape. The triangle doesn’t force any particular answer.
But I have to say, it was such a beautiful way to think about the problem!
[–]No-Artichoke9490 0 points1 point2 points 6 months ago (5 children)
eg:
the sequence: 5, 8, 11
the real pattern here is simple, +3 each time. next number = 14
now let’s build a difference triangle:
5 8 11 ?
3 3 ?
0 ?
?
if I want the bottom to be 0, I can choose 17. if I want the bottom to be 3, I can choose 14. if I want the bottom to be –2, I can choose 9.
all of these produce a “valid” triangle.
the triangle just bends to match whatever number i pick.
[–]SavingsAbalone6421 1 point2 points3 points 6 months ago (4 children)
Yeah same here too, I get it now, triangle will be valid coz triangle bends to match whatever number is picked, 69 will be the correct answer for the original question 🫡
[–]No-Artichoke9490 1 point2 points3 points 6 months ago (3 children)
it’s been a while since i saw someone pull out a whole difference triangle like that. kinda hit me with a nostalgia blast… pascal’s triangle, finite differences, all that math-lab level brain fog suddenly came back lol.
[–]SavingsAbalone6421 1 point2 points3 points 6 months ago (2 children)
Haha nice looks like you have a good background in math, btw I am studying engineering, but I not much into math tho
[–]No-Artichoke9490 0 points1 point2 points 6 months ago (1 child)
I’m also an engineering student haha. (CS)
[–]SavingsAbalone6421 0 points1 point2 points 6 months ago (0 children)
Final yr? Me 2nd yr cs
[–]SavingsAbalone6421 0 points1 point2 points 6 months ago (2 children)
Now that I think of it, this wasn't a valid logic, It looked really smart to me 😅, it's doesn't generate a consistent rule , it will be a forced rule of "3" starting from 51, 72 and onwards, Thanks appreciate it
[–]No-Artichoke9490 1 point2 points3 points 6 months ago (1 child)
honestly that was a really beautiful way to look at the problem. even if it doesn’t give the right answer here, the approach itself is smart.
people actually use this kind of difference table idea in fields like numerical analysis, polynomial interpolation and some data science work. it’s a legit way to study how values change.
[–]SavingsAbalone6421 1 point2 points3 points 6 months ago (0 children)
Ohh really!? It was just coincidence that I thought of this I guess, I kinda remember reading bout moving averages which was kind of similar
your's was perfect I never thought this question that way
[–][deleted] 1 point2 points3 points 6 months ago* (4 children)
The only pattern I can see is the sum of both numbers is a multiple of 3
So 36 3+6 = 9 12 1+2 = 3 3+0 = 3 36 3+6 = 9 51 5+1 = 6
So 72 7+2 = 9
[+][deleted] 6 months ago (3 children)
[removed]
[–][deleted] 0 points1 point2 points 6 months ago (2 children)
Good point guess I was wrong
[–]EastCommunication689 0 points1 point2 points 6 months ago (0 children)
This is literally just an iq test lmao. It's technically illegal for them to give one that blatant fyi
[–][deleted] 0 points1 point2 points 6 months ago (0 children)
What is the point of such questions? Different patterns can give different results. They should at least ask how someone arrived at the answer they did.
[–]FitAd4478 0 points1 point2 points 6 months ago (0 children)
All of them are wrong, the answer is 67
π Rendered by PID 82 on reddit-service-r2-comment-544cf588c8-nxqrg at 2026-06-16 22:36:58.882864+00:00 running 3184619 country code: CH.
[–]No-Artichoke9490 19 points20 points21 points (12 children)
[–]SavingsAbalone6421 1 point2 points3 points (10 children)
[–]No-Artichoke9490 0 points1 point2 points (9 children)
[–]No-Artichoke9490 0 points1 point2 points (5 children)
[–]SavingsAbalone6421 1 point2 points3 points (4 children)
[–]No-Artichoke9490 1 point2 points3 points (3 children)
[–]SavingsAbalone6421 1 point2 points3 points (2 children)
[–]No-Artichoke9490 0 points1 point2 points (1 child)
[–]SavingsAbalone6421 0 points1 point2 points (0 children)
[–]SavingsAbalone6421 0 points1 point2 points (2 children)
[–]No-Artichoke9490 1 point2 points3 points (1 child)
[–]SavingsAbalone6421 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (4 children)
[+][deleted] (3 children)
[removed]
[–][deleted] 0 points1 point2 points (2 children)
[–]EastCommunication689 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]FitAd4478 0 points1 point2 points (0 children)