Subarrays with distinct

out of three test case only one run where is the problem in my code

@Amre-8800,
https://ide.codingblocks.com/s/240589 corrected code.

Instead of adding arr[i] to the hashset add arr[j].