Whenever you want to maximize or minimize something in an array, by taking the values of a range from the elements of the same array, then you can do a binary search by taking the minimum and maximum of the elements of that array. Problem Link:- https://mirror.codeforces.com/contest/1623/problem/C