2
public int minimumDeletions(int[] nums) {3
int max = Integer.MIN_VALUE;4
int min = Integer.MAX_VALUE;9
// First Find out the max and min element index10
for (int i = 0; i < n; i++) {22
// if both index are same then return the part in which less number of elements are there23
if (maxInd == minInd) {24
return Math.min(maxInd + 1, n - maxInd);27
// max element is right side of min element28
if (maxInd > minInd) {32
n - minInd); // min of all the elements till max element and all the elements to the33
// right of min element34
int count1 = minInd + 1 + (n - maxInd); // all elements to the left of min and right of max35
return Math.min(count, count1); // min of both37
// min element is right side of the max element39
int count = Math.min(minInd + 1, n - maxInd);40
int count1 = maxInd + 1 + (n - minInd);41
return Math.min(count, count1);