[2.10]\560. Subarray Sum Equals K 传送门 分析:前缀和 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 class Solution { public: int subarraySum(vector<int>& nums, int k) { int n = nums.size(); vector<int> sum(n+1, 0); for (int i=0; i<n; i++) { sum[i+1] = sum[i] + nums[i]; } int ans = 0; unordered_map<int, int>