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.
how should I optimize my code, it is able to pass only two test cases and in rest time exceeded
# Enter your code here. Read input from STDIN. Print output to STDOUTimportmathinp=list(map(int,input().split()))x=inp[0]y=inp[1]length=len(str(y))+1total=0ls1=set()ls2=set()foriinrange(1,x+1):forjinrange(1,y+1):ls1.add((i*j*pow(10,length)))ls2.add(int(str(i^j).zfill(length)))foriinls1:forjinls2:total=total+(i+j)print(total)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
HackerRank Number
You are viewing a single comment's thread. Return to all comments →
how should I optimize my code, it is able to pass only two test cases and in rest time exceeded