Question
Given an array of integers nums and an integer k, return the total number of continuous subarrays whose sum equals to k.
https://leetcode.com/problems/subarray-sum-equals-k/
- Solution1
1 | class Solution { |
Complexity:
Time complexity: O(n)
Space complexity: O(n)