Getting error in subarrays wirh distinct element

Please Tell me the problem in my code and also the test cases for which my code fails.