+ 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.

27th Dec 2019, 1:37 AM
CASOY
CASOY - avatar
10 Answers
+ 6
Mihai Apostol In this 🐍 case memoization is enough ‼️🤔 You haven't change recursion limit‼️🤔
28th Dec 2019, 12:20 PM
Janusz Bujak 🇵🇱 🇺🇦
Janusz Bujak 🇵🇱 🇺🇦 - avatar
+ 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.
27th Dec 2019, 10:48 AM
Mihai Apostol
Mihai Apostol - avatar
+ 5
John Bryan Pit Acaso Don't show your Code Coach solutions in public ‼️
28th Dec 2019, 10:59 AM
Janusz Bujak 🇵🇱 🇺🇦
Janusz Bujak 🇵🇱 🇺🇦 - avatar
+ 5
John Bryan Pit Acaso Never mind, these solutions even didn't pass because of deep recursion⁉️🤔
28th Dec 2019, 11:31 AM
Janusz Bujak 🇵🇱 🇺🇦
Janusz Bujak 🇵🇱 🇺🇦 - avatar
+ 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.
28th Dec 2019, 5:01 PM
Michele
Michele - avatar
+ 2
woaahh!! I did it! thanks a lot Alexandr.
27th Dec 2019, 3:05 AM
CASOY
CASOY - avatar
+ 2
Janusz Bujak 🇵🇱 Actualy I did. Only with memoization I wasn't passing test #6
28th Dec 2019, 12:30 PM
Mihai Apostol
Mihai Apostol - avatar
+ 1
Sorry about that, I just thought its fine, it's wrong anyway.
28th Dec 2019, 11:17 AM
CASOY
CASOY - avatar
+ 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.
28th Dec 2019, 11:34 AM
CASOY
CASOY - avatar
+ 1
In my opinion recursion is inefficient in most cases. It's only from time to time more elegant.
29th Dec 2019, 12:00 AM
JaScript
JaScript - avatar