Lower_bound() in sets

why does it prints 6 ,isn’t it supposed to s.end().?

hello @Codingniko121
The lower_bound() method in C++ is used to return an iterator pointing to the first element in the range [first, last) which has a value not less than val. This means that the function returns the index of the next smallest number just greater than that number.

there is no element greater than 15
hence end of container ie size of container is returned

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.