Subarray Sum Equals K

JavaScript Medium 3 views
Back to Questions

Problem Description

Given n, k and an array. Count how many subarrays have sum exactly k.

Input Format

Line1: n k. Line2: n integers.

Output Format

One integer count.

Sample Test Case

Input:
5 3 1 2 1 1 -1
Output:
3

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next