I don’t understand how lower bound fun works someone telling it return value which is greater or equal to key value but it not
you can see my code here and run it on your own compiler
#include <bits/stdc++.h>
using namespace std;
bool comp(int a,int b){
cout<<"comparing “<<a<<” and "<<b<<endl;
return a>=b;
}
int main() {
int a[]={1,2,5,10,20,50,100,100,100,500,1000,2000};
int n=sizeof(a)/sizeof(int);
int key=100;
// cin>>key;
auto lb=lower_bound(a,a+n,key,comp)-a;
//cout<<“index”<<lb<<" at"<<a[lb]<<endl;
cout<<lb;
return 0;
}