Handling duplicate numbers

In my code how can i handle duplicate numbers in the array.
code link : https://ide.codingblocks.com/s/109921

can plzz someone look at my code i got stuck in this question.

@himanshukumarclassic37.hk
Please provide the question link as well.

question link : https://hack.codingblocks.com/contests/c/670/209

@mailmeanmolbansal have u found the error in my code yet?

@himanshukumarclassic37.hk
for handling duplicate numbers we need to keep Count of Arrays,using
HashMap<Integer,Integer>.
The approach is to build HashMap from first array with count,then decrement the HashMap using Array2.
And print while traversing the Array2.

@mailmeanmolbansal I have done the required changes in my code but still number 2 is printing three times.
code link : https://ide.codingblocks.com/s/110855

@himanshukumarclassic37.hk
Changes to be made
1 .We have to print the sorted list(use Collections.sort) to sort the list.
2. We have to only add in the result list when the element searched have frequency greater than 0.
I made above two changes and it passed.
Please make above changes and revert back.

@mailmeanmolbansal still unable to implement the second condition. Can u plzz update my code?


updated code with comments.

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.