+ 3

Pls help. What's wrong with my code?

My code clears the first 2 test cases only. What may have gone wrong? ~Hofstadter's Q-Sequence~ n=int(input()) def Q(n): if n<=2: return 1 else: return (Q(n-Q(n-1)) + Q(n-Q(n-2))) print(Q(n)) https://code.sololearn.com/cD9MUyR3UNYW/?ref=app

1st Mar 2021, 11:56 AM
Twilight🌅
Twilight🌅 - avatar
1 Answer