Money change problem

in money change problem when we are using comparator function which is returning number less than or equal to key so why are we reducing one from its index?? its already returning number less than or equal to key

#include <bits/stdc++.h>
using namespace std;
bool comp(int a,int b){
return a<=b;
}
int main() {
int arr[]={1,2,5,10,20,50,100,200,500};
int n=sizeof(arr)/sizeof(int);
int i=lower_bound(arr,arr+n,10,comp)-arr-1;
cout<<i<<"value at this index is : "<<arr[i]<<endl;

return 0;

}

in lower_bound() internally comparision is done like
return a<b;
due to which when we write
int i=lower_bound(arr,arr+n,10,comp)-arr-1;
cout<<i<<"value at this index is : "<<arr[i]<<endl;
output is: 2value at this index is : 5
but we need 10 here so we include equal also in comparision function

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.