#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
}
int f1(int arr[], int n)
{
int left = 0; // Index of the left boundary
int right = n - 1; // Index of the right boundary
while (left < right) {
int mid = left + (right - left) / 2; // Find the middle index
if (arr[mid] > arr[mid + 1]) {
// We are in the descending part of the array, move left
right = mid;
}
else {
// We are in the ascending part of the array, move right
left = mid + 1;
}
}
return arr[left]; // The maximum element will be at the left index
}