Last active
March 14, 2021 06:11
-
-
Save minhphong306/47560403387281f0935aa98c13c3c174 to your computer and use it in GitHub Desktop.
sol5.go
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
func sol5(arr []int) int { | |
arr2 := make([]int, len(arr)) | |
for _, item := range arr { | |
if arr2[item] < 0 { | |
return item | |
} | |
arr2[item] = -2 | |
} | |
return -1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment