Subarrays with distinct elements

if the array has duplicates do we need to remove them first ?

Hi Abhishek,
No you don’t have to remove the duplicates.

Hey then what shall be the output for 3

Hey then what shall be the output for 3 : {1,2,1}

Hi
ans: 7

solution: 1 (1) + 1(2) +(1) + 2(1,2)+ 2(2,1) =7