Skip to content

Instantly share code, notes, and snippets.

@souvikhaldar
Last active September 3, 2019 12:16
Show Gist options
  • Save souvikhaldar/122d817fd84380fcbf4ff6b421015d66 to your computer and use it in GitHub Desktop.
Save souvikhaldar/122d817fd84380fcbf4ff6b421015d66 to your computer and use it in GitHub Desktop.
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