← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
Problem Statement
Given an array of integers nums and an integer k, return the total number of continuous subarrays whose sum equals k. A subarray is a contiguous part of the array.[1][10]
Examples
Input: nums =, k = 2[1]
Output: 2
Explanation: The subarrays are (indices 0-1) and (indices 1-2).[4][1]
Input: nums =, k = 3[2][3][1]
Output: 2
Explanation: The subarrays are and.[3][2][4][1]
Input: nums = [2,2,-4,1,1,2], k = -3
Output: 1.[1]
Constraints