Array intersection of two array

I am using hashmap technique to solve this problem but my output is repeating please check my code
https://ide.codingblocks.com/s/60571

STL Map stores unique key value pairs . Hence when you store these values 1 ,1 ,2,2 3.
The only value stored is 1,2,3 . Instead try storing key and its frequency .

1 Like

this problem is resolved