Skip to content

Instantly share code, notes, and snippets.

@acoshift
Last active October 15, 2017 13:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save acoshift/2f942666022268c9094ceced1a0413d9 to your computer and use it in GitHub Desktop.
Save acoshift/2f942666022268c9094ceced1a0413d9 to your computer and use it in GitHub Desktop.
remove duplicate: loop 2
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