1. Given an array.
2. Return the sum of lengths of contiguous subarrays having all distinct elements.
Input Format
First line contains N (number of elements in the array). Second line contains N space separated integers.
Output Format
Return an integer.
Constraints
1<=N<=10^5
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
4 1 2 3 4
Output
20