Problem Statement :
You are given an array \(A\) of \(N\) integers. You have to find the number of the magical array's that are a subarray of the given array.
A magical array is one which does not have distinct elements.
For example, [2 2 2], [1 1 1] are magical arrays while [2 2 2 3], [3 3 1 3] are not magical arrays.
Input format :
The first line contains one integer \(N\) — the number of elements in the array.
The second line contains \(N\) spaced integers \(A_0,A_1,A_2,.....A_{n-1}\) .
Output format :
Print one integer, the number of magical subarrays.
Constraints :
Here, n = 4 and a = [5, 5, 4, 4].
So, The magical arrays are [5], [5], [4], [4], [5, 5], [4, 4].
The count of magical arrays is 6.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor