Created
October 15, 2017 06:24
-
-
Save acoshift/d1768da071e429e0f86c49624d519307 to your computer and use it in GitHub Desktop.
remove duplicate: loop
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 removeDuplicateLoop(arr []int) []int { | |
p := append([]int{}, arr...) | |
for i := range p { | |
for j := i + 1; j < len(p); j++ { | |
if p[i] == p[j] { | |
p = append(p[:j], p[j+1:]...) | |
j-- | |
} | |
} | |
} | |
return p | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment