Last active
October 15, 2017 13:05
-
-
Save acoshift/2f942666022268c9094ceced1a0413d9 to your computer and use it in GitHub Desktop.
remove duplicate: loop 2
This file contains hidden or 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 removeDuplicateLoop2(arr []int) []int { | |
r := make([]int, 0) | |
for i := range arr { | |
for j := range r { | |
if arr[i] == r[j] { | |
goto duplicated | |
} | |
} | |
r = append(r, arr[i]) | |
duplicated: | |
} | |
return r | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment