Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 401 Bytes

File metadata and controls

13 lines (10 loc) · 401 Bytes

Problem 8: Prefix Sum Congruence (Subarray Sum Equals K)

Problem Statement

Given an array of integers nums and an integer k, return the total number of subarrays whose sum equals to k. A subarray is a contiguous non-empty sequence of elements within an array.

Input Format

  • An array of integers nums.
  • An integer k.

Example

Input: nums = [1, 1, 1], k = 2
Output: 2