Pair with Target Sum

Talk it through out loud with your AI coach.

The problem

  • easy

You're given a list of integers and a target number. Find two different positions in the list whose values add up to the target, and return those two positions. You can assume exactly one such pair exists.

What a strong answer covers

  • The obvious solution first, and what it costs as the list grows.
  • A faster idea that remembers what you've already seen.
  • The time and memory the faster version needs.
  • An edge case with repeated values.

Common mistake: Jumping straight to code without saying why the simple version is slow, or pairing a number with itself.

Knowing this is half of it. Saying it clearly out loud is the part the coach helps you practise.

Practise it out loud