We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
My python code passed 20 test case but other 20 test cases showing time exceeded problem.Please any one let me know which lines of code i can optimize.
N=int(input())
while True:
S = input()
if len(S) != N:
print("Invalid input")
exit()
M=int(input())
result=[]
for i in range(M):
cmd=input()
c=cmd.split(' ')
Hamming Distance
You are viewing a single comment's thread. Return to all comments →
My python code passed 20 test case but other 20 test cases showing time exceeded problem.Please any one let me know which lines of code i can optimize.
N=int(input())
while True:
S = input() if len(S) != N: print("Invalid input") exit() M=int(input()) result=[] for i in range(M): cmd=input() c=cmd.split(' ')
r=[print(i) for i in result]