Created
October 3, 2018 17:00
-
-
Save sillyfellow/085a55a8dd5341e4c13e03aab7d6bc48 to your computer and use it in GitHub Desktop.
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 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