Find First and Last Position of Element in Sorted Array
MediumLeetCodeBinary Search
Approach hintTry it first, then revealHide
Run two boundary searches: the first index with value >= target and the first index with value > target. If both land on the same index, the target is absent.