You are viewing a single comment's thread. Return to all comments →
L=[] N=int(input("")) if N>=2 and N<=10**5: for a in range(2,N+1): for b in range(2,N+1): c=a**b if c not in L: L.append(c) else: pass print(len(L)) else: pass
I used the same principle in my code. But this only passes the first six test cases - timing out on the rest :-(
Seems like cookies are disabled on this browser, please enable them to open this website
I agree to HackerRank's Terms of Service and Privacy Policy.
Project Euler #29: Distinct powers
You are viewing a single comment's thread. Return to all comments →
I used the same principle in my code. But this only passes the first six test cases - timing out on the rest :-(