Company: EPAM__
Difficulty: medium
1. Partial Sorting Problem Statement You are given an array A of N numbers. You can perform the following operation: swap any two adjacent numbers in A . Your task is to print the minimum number of operations to be performed such that A satisfies the following property: The maximum number in A should occupy the first position. The minimum number in A should occupy the last position. The order of other numbers doesn't matter. A necessarily does not contain distinct elements. That is, A might contain more than one occurrence of a number. Input Format The first line of input consists of a single integer N , denoting the size of A . The next N lines contain the integers denoting the elements of A . Constraints 2 <= N <= 100 1 <= A i <= 100 Output Format Return a single integer, denoting the solution to the problem. Sample Sample Input 4 2 4 3 1 Sample Output 1 Explanation The given array is A = [2, 4, 3, 1] . The size of the array is N = 4 . The maximum element is 4, and the mi