+ 1

I am getting runtime error in some of the test cases. Help me solving the issue

https://www.hackerrank.com/contests/projecteuler/challenges/euler230/problem

30th Jun 2020, 4:06 PM
UnknownX
UnknownX - avatar
3 Respuestas
+ 1
q=int(input()) for i in range(0,q): A,B,n=input().split() A,B,n=str(A),str(B),int(n) while len(B)<n: A+=B B+=A print((A)[n-1] if len(A)>n else (B)[n-1])
30th Jun 2020, 4:25 PM
UnknownX
UnknownX - avatar
0
The way you are doing is very naive . https://www.sololearn.com/post/431255/?ref=app See codes by michal and bobby. The problem arises when the size of string is too large. Here's an hint: F[n] = F[n-1]+ F[N-2] Also see bobby's explanation there.
2nd Jul 2020, 5:00 AM
Hima
Hima - avatar