public boolean findSubarrays(int[] nums) {
Map<Integer,Integer> allSets = new HashMap<>();
for(int i = 0; i < nums.length - 1; i++){
int res= nums[i] + nums[i+1];
if(allSets.containsKey(res)){
return true;
}
allSets.put(res, allSets.getOrDefault(res,0)+1);
}
return false;
}
}
这题没什么好说的 ,集合也可以,很简单
2395. 和相等的子数组[每日一题]
发布时间 2023-03-26 23:36:31作者: RickieRun