- 对比 560
class Solution {
public:int maxNonOverlapping(vector<int>& nums, int target) {unordered_map<int,int> map;map[0]=1;int cnt=0;int sum=0;for(auto& x: nums){sum+=x;if(map.count(sum-target)){cnt++;map.clear();map[0]=1;sum=0;}else{map[sum]++;}}return cnt;}
};