Doubt in Intersection Of Array

Question
Take as input N, the size of array. Take N more inputs and store that in an array. Take N more inputs and store that in another array. Write a function which gives the intersection of two arrays in an ArrayList of integers and Print the ArrayList.

Constraints:
Length of Arrays should be between 1 to 1000.

Sample Input:
7
1 2 3 1 2 4 1
2 1 3 1 5 2 2
Sample Output:
[1, 1, 2, 2, 3]
Explanation:
Check which integer is present in both the arrays and add them in an Arraylist .Print ArrayList as the ans.

Despite using the hashmap and maintaining the frequency of each element and sorting the output array, the test case is not being passed
Code https://ide.codingblocks.com/s/118313

@ratulhans In line number 31 just put a space after the comma and then check.

Hope this helps! :slightly_smiling_face:

Thanks,it is now working

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.