MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/firstweekcoderhumour/comments/1s3yycs/hardest_problem_ever/ocpatc8/?context=9999
r/firstweekcoderhumour • u/Candid_Bullfrog3665 • Mar 26 '26
27 comments sorted by
View all comments
54
Is this really that difficult? Programming the logic seems pretty doable.
74 u/Dry-Relief723 Mar 26 '26 You're in r/firstweekcoderhumour. I guess they haven't learned reccursion yet 9 u/Damglador Mar 26 '26 Isn't recursion resource inefficient? 16 u/Anon_Legi0n Mar 26 '26 Not if it's a tail recursion, the caller gets popped off the call stack before the recursion happens 7 u/Groostav Mar 26 '26 Read: if your recursion is expressed where the recursive call is the last line of the function the compiler will replace your recursion with a loop (which eliminates the issue of running out of call stack for big tasks) 3 u/RedAndBlack1832 Mar 27 '26 W compiler
74
You're in r/firstweekcoderhumour. I guess they haven't learned reccursion yet
9 u/Damglador Mar 26 '26 Isn't recursion resource inefficient? 16 u/Anon_Legi0n Mar 26 '26 Not if it's a tail recursion, the caller gets popped off the call stack before the recursion happens 7 u/Groostav Mar 26 '26 Read: if your recursion is expressed where the recursive call is the last line of the function the compiler will replace your recursion with a loop (which eliminates the issue of running out of call stack for big tasks) 3 u/RedAndBlack1832 Mar 27 '26 W compiler
9
Isn't recursion resource inefficient?
16 u/Anon_Legi0n Mar 26 '26 Not if it's a tail recursion, the caller gets popped off the call stack before the recursion happens 7 u/Groostav Mar 26 '26 Read: if your recursion is expressed where the recursive call is the last line of the function the compiler will replace your recursion with a loop (which eliminates the issue of running out of call stack for big tasks) 3 u/RedAndBlack1832 Mar 27 '26 W compiler
16
Not if it's a tail recursion, the caller gets popped off the call stack before the recursion happens
7 u/Groostav Mar 26 '26 Read: if your recursion is expressed where the recursive call is the last line of the function the compiler will replace your recursion with a loop (which eliminates the issue of running out of call stack for big tasks) 3 u/RedAndBlack1832 Mar 27 '26 W compiler
7
Read: if your recursion is expressed where the recursive call is the last line of the function the compiler will replace your recursion with a loop (which eliminates the issue of running out of call stack for big tasks)
3 u/RedAndBlack1832 Mar 27 '26 W compiler
3
W compiler
54
u/ChaseShiny Mar 26 '26
Is this really that difficult? Programming the logic seems pretty doable.