Subarrays with distinct elements..ssdd

getting WA for testcase 2 and 3…please see it…

Your code is not running for large values of n.
Fix the error.
I am attaching a pair of sample input-output.

Hope, this would help.