Question bank › Prefix Sum
Dsa Prefix Sum Medium

Longest Subarray with Minimal Prefix

You have an integer array. Your goal is to find the length of the longest contiguous subarray such that the smallest prefix sum from that subarray is minimal. Implement a function to find this length efficiently. Example Input: 6 2 -1 -3 4 -1 2 Example Output: 5

Key concepts

prefix_summax_lengtharray

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 InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.