Skip to content

Instantly share code, notes, and snippets.

@sillyfellow
Created October 3, 2018 17:00
Show Gist options
  • Save sillyfellow/085a55a8dd5341e4c13e03aab7d6bc48 to your computer and use it in GitHub Desktop.
Save sillyfellow/085a55a8dd5341e4c13e03aab7d6bc48 to your computer and use it in GitHub Desktop.
func intersection(s1, s2 string) string {
m := map[rune]bool{}
for _, c := range s1 {
m[c] = true
}
var ret string
for _, c := range s2 {
if _, y := m[c]; y {
ret += string(c)
}
}
return ret
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment