Question bank › Prefix Sum
Dsa Prefix Sum Hard

Subarray Target Count with Prefix

You are given an integer array and a target sum. Count how many contiguous subarrays have a sum equal to the target. The input starts with integer N (size of the array), followed by N integers and then the target sum. Example: Input: 5 1 2 3 4 5 5 Output: 2

Key concepts

prefix_sumcounting

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.