Giving wrong o/p - subarrays with distinct elements

I made the code as per as discussed in hint video but still not giving correct output.
Please check the code and correct it my commenting.

@as159925
I have fixed the code.
you were using erase, it does not put any element in the map.