+ 3
[SOLVED] Code coach Q-sequence
My code pass the first two tests and then fails. I can't figure out the reason. https://code.sololearn.com/c3id5Vl0sDVK/?ref=app
4 ответов
+ 2
In this code coach you can't use recursive like that because when the input is too big (34 I remember), the code won't output anything because of time exceed.
+ 6
To many unnecessary calculations making time limit exceed. The function is called with the same argument many times, resulting in the same recursive calculations to compute over and over. Try to break it down using paper and pencil.
Solutions:
1-) Use memoization
2-) Write the code in iterative fashion <- easy and my recommended solution.
+ 2
Kevin ★ thank you as well 🙏🤗
I am going to do it 😎
+ 1
They could warn users about that. You can't leave people looking for a bug that doesn't exist 😭😭😭
Anyway thank you so much CarrieForle 🙏🤗