← Microsoft questions
CodingReported in a candidate post, Jan 2022

First and last position of an element in a sorted array

Filed under Microsoft

Given an array of integers nums sorted in non-decreasing order and a target value, return the indices of the first and last occurrence of target as [first, last]. If target is not present, return [-1…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Microsoft questions

Collected from public candidate posts and coding forums. Updated Nov 2026.