+ 5
Anybody have a solution to code coach q-sequence challenge without using recursion?
I think the code coach new problem q-sequence can't be solved, it requires numerous recursion and sololearn don't support that.
10 Answers
+ 6
Mihai Apostol In this 🐍 case memoization is enough ‼️🤔 You haven't change recursion limit‼️🤔
+ 5
John Bryan Pit Acaso In Python standard recursion limit is 1000. Use, let's say:
import sys
sys.setrecursionlimit (10 ** 6)
Then use memoization.
It is how I solved it with recursion.
+ 5
John Bryan Pit Acaso
Don't show your Code Coach solutions in public ‼️
+ 5
John Bryan Pit Acaso
Never mind, these solutions even didn't pass because of deep recursion⁉️🤔
+ 5
Recursion is too inefficient in this case. I created an array (size of the input). So a pointer to a dynamic array. Then used a loop.
+ 2
woaahh!! I did it! thanks a lot Alexandr.
+ 2
Janusz Bujak 🇵🇱 Actualy I did. Only with memoization I wasn't passing test #6
+ 1
Sorry about that, I just thought its fine, it's wrong anyway.
+ 1
It only passed case 1 and 2. I tried to pass 32 and above as input and it returned nothing.
Then I found memoization as answer.
+ 1
In my opinion recursion is inefficient in most cases. It's only from time to time more elegant.