func intersect(nums1 []int64, nums2 []int64) []int64 {
res := make([]int64, 0)
map1 := map[int64]int64{}
for _, v := range nums1 {
map1[v] += 1
}
for _, v := range nums2 {
if map1[v] > 0 {
res = append(res, v)
map1[v] -= 1
}
}
return res
}