Anyone have any intuition for this problem?
Find the longest subarray of an array where the frequency of each element in the subarray must be the same.
I’ve been trying for so long to find an nlogn or n solution and I can’t figure it out even after looking online. Would love to hear some ideas.
the values of arr[i] can be much larger than the length of the arr, so a solution where you normalize the count of each value at every index seems too slow.
length(arr) <= 105 a[i] <= 107