Created
August 16, 2017 13:32
-
-
Save arxdsilva/273776300af8487937a871cc92928317 to your computer and use it in GitHub Desktop.
comparing two slices in go
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 compare(a, b []string) []string { | |
for i := len(a) - 1; i >= 0; i-- { | |
for _, vD := range b { | |
if a[i] == vD { | |
a = append(a[:i], a[i+1:]...) | |
break | |
} | |
} | |
} | |
return a | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment