Interview-School

Solution for problem 0560

Project initialized using dotnet core CLI:

dotnet new console

Original problem : Subarray Sum Equals K https://leetcode.com/problems/subarray-sum-equals-k

Given an array of integers and an integer k, you need to find the total number of continuous subarrays whose sum equals to k.

Example 1 :

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

Solution