Https://ide.codingblocks.com/s/186144

what is wrong in this code?

Hey @meetsoni01041996 only using upper_bound and lower_bound is not sufficient for this question. They always return an index for insertion and don’t tell if the element is present or not. Instead use the binary_search() function and then use these two. Take a look at this code https://ide.codingblocks.com/s/186156

If you don’t have any further queries please mark the doubt as resolved.

Using binary_search my all test cases are passed but can you give me more explanation about this line if(binary_search(a.begin(),a.end(),no)) ?

Thank you

Ofcourse @meetsoni01041996, this function returns true if that value is present in your array otherwise returns false.
Please mark the doubt as resolved if you don’t have any further queries