← Microsoft questions
CodingReported in a candidate post, Nov 2020

Minimum length subarray with sum x

Filed under Microsoft

Given an array of integers nums and an integer x, find the minimum length of a contiguous subarray whose sum is exactly equal to x. Return 0 if no such subarray exists.

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.