Shortest Stretch Reaching a Sum

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 list of positive integers and a target, find the length of the shortest contiguous stretch whose sum is at least the target, or zero if there is none. Explain your approach and why it matters that the numbers are positive.

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 →