https://www.youtube.com/watch?v=GU7DpgHINWQ
https://usaco.guide/silver/binary-search?lang=cpp
As you know, everything has its good, better and the best.
Simple binary search algo. Remember a few things:
Sample Implementation: (3 conditions)
<aside> 💡 When you are said to find minimum/maximum based upon a given condition, you might need to use binary search.
</aside>
Here, you might need to merge the == condition with < or > , where you need to save it in a temporary variable as possible answer.
<aside> 💡 you can create a f(x) that will return T or F.
</aside>
Let’s talk about the 2nd one. It’s Also known as lower or upper bound.