Dsa
Two Pointers
Medium
Target Sums in Range
You are given an array 'nums' of integers and a target sum 't'. Your task is to find the number of continuous subarrays whose sum equals 't'. Return the count of such subarrays.
Input Format:
- A single line containing the length of 'nums', followed by 't', and then 'nums'.
Output Format:
- A single integer representing the count of subarrays.
Example:
Input:
5 4
1 2 1 2 1
Output:
4
Key concepts
two_pointersarraysearch
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