Smallest Subarray With All Occurrences Of The Most Frequent Element
1. You are given an array(arr) of integers. 2. You have to find the element(x) with maximum frequency in the given array. 3. Also, you have to find the smallest subarray which has all occurrences of the most frequent element i.e x. Note -> If there are two or more elements with maximum frequency and the same subarray size then print the subarray which occurs first in the given array.
1 <= N <= 10^6 1 <= arr[i] <= 10^5
A number N arr1 arr2.. N numbers
A number(x) representing the maximum frequency element in the given array. Two numbers representing the start and end index of the smallest subarray with all occurrences of the most frequent element.
8 4 1 1 2 2 1 3 3
1 1 5