Last active
September 3, 2019 12:16
-
-
Save souvikhaldar/122d817fd84380fcbf4ff6b421015d66 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
package main | |
import ( | |
"fmt" | |
) | |
func appendCategory(a []string, b []string) []string { | |
check := make(map[string]int) | |
d := append(a, b...) | |
res := make([]string,0) | |
for _, val := range d { | |
check[val] = 1 | |
} | |
for letter, _ := range check { | |
res = append(res,letter) | |
} | |
return res | |
} | |
func main() { | |
a := []string{"x", "y", "z"} | |
b := []string{"x", "p", "q"} | |
c := appendCategory(a, b) | |
fmt.Println(c) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment