Lower Bound
Learn Lower Bound (Searching, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
What is Lower Bound? The lower bound of a target in a sorted array is the index of the FIRST element that is ≥ target - even if the target itself isn't present, it's where it WOULD be inserted to keep the array sorted. A small tweak to binary search: instead of stopping on an exact match, keep narrowing toward the leftmost valid position.