Intersection of 2 arrays

Hello sir/ma’am, my code for this problem is not passing test case 1, could you please tell what is wrong??

Check for the sample input:
7
1 2 3 1 2 4 1
2 1 3 1 5 2 2

Expected o/p:
[1, 1, 2, 2, 3]

Your o/p:
[1, 1, 2, 2, 2, 3]

Dry run your code with this case and try to correct it.

Okay, got it… Thank you sir!!