upper_bound and lower_bound for non increasing vector in c++
The lower_bound() and upper_bound() functions, by default works on non-decreasing array. The lower_bound() function finds iterator of first element that does not compare less to given element. The upper_bound() function returns iterator to the first element that is greater.
Given an array converting this to a non-increasing vector, applying the std:: upper_bound and std:: lower_bound function to the vector
For array sorted in a non-increasing array, lower_bound() finds iterator to the first element that does not compare greater than to given element. upper_bound() finds iterator to the first element that is smaller than the given element. We use greater() for this purpose.
lower_bound at position 5 upper_bound at position 4