Minimize swaps required to make the first and last elements the largest and smallest elements in the array respectively

  #include using namespace std;  int minimum_swaps(int arr[], int n){        int count = 0;          int max_el = *max_element(arr,                              arr + n);          int min_el = *min_element(arr,                              arr + n);              if (min_el == max_el)        return 0;              int index_max = -1;    int index_min = -1;      for (int i = 0; i < n; i++) {                          if (arr[i] == max_el            && index_max == -1) {            index_max = i;        }                          if (arr[i] == min_el) {            index_min = i;        }    }              count += index_max;              count += (n - 1 - index_min);              if (index_min < index_max)        count -= 1;      return count;}  int main(){    int arr[] = { 2, 4, 1, 6, 5 };    int N = sizeof(arr) / sizeof(arr[0]);    cout