You are given an array arr of size N of non negative integers. Find number of subarrays of array which are special. A subarray is special if product of its maximum and minimum element in divisible by length of the subarray.
Find Number of special Subarrays.
1 <= N <= 10^5
0 <= arr[i] <= 30
Can anyone tell me approach for this problem?