Where to Insert

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

  • easy
  • Pro

Given a sorted list of distinct integers and a target, return the target's position if it's present, or the position where it would be inserted to keep the list sorted. Explain your approach and how you avoid off-by-one mistakes.

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 →