-
-
Save dit7ya/b07bea313e7bee5894e20445372f1efa to your computer and use it in GitHub Desktop.
CodeSignal First Interview Problem
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 numpy as np | |
def firstDuplicate(a): | |
num = -1 | |
seen = np.zeros(len(a)) | |
for x in a: | |
if seen[x - 1] == 0: | |
seen[x - 1] +=1 | |
else: | |
num = x | |
break | |
return num |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment