Last active
December 30, 2021 22:58
-
-
Save CrimsonScythe/6ed04f2fbde14568d2123646af1e88e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import random | |
def solution(A, B): | |
for i in range(len(A)): | |
if A[i] not in B: | |
return A[i] | |
def solution2(A, B): | |
H=set(B) | |
for i in range(len(A)): | |
if A[i] not in H: | |
return A[i] | |
L = list(range(0, 100000)) | |
L[-3] = -random.randint(0,100000) | |
R = list(range(0, 100000)) | |
st=time.time() | |
solution(L, R) | |
print("elapsed 1", time.time() - st) | |
st=time.time() | |
solution2(L, R) | |
print("elapsed 2", time.time() - st) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment