Subarray Range With Given Sum

easy
1. Given an unsorted array arr[] of N integers and a sum. 2. The task is to count the number of subarray which adds to a given number. 3. Input and output is handled for you 4. It is a functional problem ,please do not modify main()

Input Format

first line contains size of array N and sum. second line contains N integers of array. Input is handled for you.

Output Format

Return count of the subarray which adds to the given sum. Output is handled for you.

Constraints

1 <= N <= 105
 -10^5 <= arr[i] <= 10^5
 -10^5 <= sum <= 10^5

Notice

Try First, Check Solution later

1. You should first read the question and watch the question video.
2. Think of a solution approach, then try and submit the question on editor tab.
3. We strongly advise you to watch the solution video for prescribed approach.

Example

Input
5 -10
10 2 -2 -20 10
Output
3
Previous
String Subsequence Game
Next
Subarray Sums Divisible By K

Related Questions