First and Last Position

Talk it through with a coach who asks guiding questions and gives hints until you reach the answer. Pass to mark the challenge as completed.

The problem

  • medium
  • Pro

Given a sorted list that may contain repeats and a target value, find the first and last positions where the target appears, or report that it's missing. Explain how to do it in logarithmic time.

Talk this problem through with an AI coach

This is a Pro challenge. Sign in with Google, then upgrade to start a voice session.

Start free →