Both std::lower bound and std::upper bound must have an increasing (non-decreasing) order as their objective.
By giving a comparator as the 4th parameter of the functions, you may modify the meaning of "growing."
To work with descending vectors, use std::greater.
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
int main()
{
...READ MORE
Jun 14, 2022
in C++
by
Damon
• 4,960 points
•
1,470 views