Question bank › Sliding Window
Dsa Sliding Window Medium

Min Length Subarray Sum

Given an array of positive integers and an integer target, find the minimal length of a contiguous subarray of which the sum is greater than or equal to target. If there is no such subarray, return 0. The first line of the input contains the array size n (1 <= n <= 10^5) followed by n integers and the target integer. Output the minimal length of a subarray that meets the criteria. Example: Input: 9 2 3 1 2 4 3 5 6 9 7 Output: 2

Key concepts

sliding_windowarrays

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.