Leetcode 34. Find First and Last Position of Element in Sorted Array
Given a sorted (non-decreasing) array, return the starting and ending indices of a target value (or [-1, -1] if it’s not present). The challenge is to do this in O(log n) time by locating the leftmost and rightmost occurrences (e.g., with binary-search boundary searches).
Asked at:
Sprinter Health
Meta
Amazon
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Early July, 2026
Sprinter Health
Senior
Mid January, 2026
Amazon
Mid-level
Given an array of integers nums sorted in non-decreasing order, find the starting and ending position of a given target value. If target is not found in the array, return [-1, -1].
Late September, 2025
Meta
Mid-level
Hello Interview Premium
Your account is free and you can post anonymously if you choose.