Subarray with distinct element

https://ide.codingblocks.com/s/60797 kindly check my code it passes one test case

Hi Neeraj, just change line number 10 to m.insert(make_pair(arr[j],arr[j])); instead of m.insert(make_pair(arr[i],arr[i]));
Rest of the logic works fine.

thank you so much @Khushboo khushboo

https://ide.codingblocks.com/s/68499 This code is only passing one test case. The two remaining show TLE.
Please Help