Skip to content

Instantly share code, notes, and snippets.

@CrimsonScythe
Last active December 30, 2021 22:58
Show Gist options
  • Save CrimsonScythe/6ed04f2fbde14568d2123646af1e88e7 to your computer and use it in GitHub Desktop.
Save CrimsonScythe/6ed04f2fbde14568d2123646af1e88e7 to your computer and use it in GitHub Desktop.
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