Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main
- import "fmt"
- func main() {
- a := []string{"a", "b", "c", "d", "e", "f", "g"}
- b := []string{"a", "1sdsdfsdfsdsdf", "c", "d", "e", "f", "g", "b"}
- fmt.Println(missing(a, b))
- }
- func missing(a, b []string) string {
- lookup := make(map[string]bool, len(a))
- for _, val := range a {
- lookup[val] = true
- }
- for _, search := range b {
- if lookup[search] != true {
- return search
- }
- }
- return ""
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement