Subarray with distinct element

it is only passing the 0th test case rest of the two case are failing…
plz look into this

remove each element from set later