Subarrays with distinct elements


1 test case giving TLE…
i think the algorithm works in o(n) time

@Bansaljatin05 you are running a while loop inside for loop for every element it will surely give you TLE.think of a optimized approach where you do not have to count every sequence .

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.