Problem 34 · Medium

Find First and Last Position

Find the first and last positions of a value in a sorted list, or report that it is absent. The visual narrows two binary-search bounds toward the left and right edges of the run.

Open the interactive visualisation