Search
⌘K
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:
Meta
Amazon
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
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
Early September, 2025
Meta
Senior
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.