Problem Description

Task: return how many subarrays have sum exactly k (negative numbers allowed). Use prefix sum + hashmap.

Input Format

Java method

Output Format

Return value

Constraints

O(n) time expected.

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next