CN: Implement Lower Bound

#binary-search

Problem

Intuition

We need to find a number that is present in the least index, if not find the least index where the number would fit.

It is not a traditional binary search problem. We are not searching for a particular target, but we are trying to find where the given target would fit even if it exists are not.

The template is the same, but with little twist:

Time Complexity

O(log(n))

Space Complexity

O(1)

Solution

Last updated