Count of positions j in Array such that arr[i] is maximum in index range [i, j] with end points as same
Given an array arr[] consisting of N positive integers, the task is to find all j such that arr[j] = arr[i] and all the numbers in the range [min(j, i), max(j, i)] is less than or equal to arr[i] where 1 ⤠i ⤠N. Examples: Input: arr[] = {4, 7, 7, 9, 7}, N = 5Output: 1 2 2 1 1Explanation:For i = 1,