Given an array of integers nums and an integer k, return the total number of continuous subarrays whose sum equals to k
问题 def subarraySum(self, nums: List[int], k: int) -> int: count = 0 target = k self.cal(nums,target,count,k) return count def cal(nums,target, count,k): if target == 0: count = count+1 target = k return count,target if target<0: return for i in range(len(nums)): self.cal(nums[:i]+nums[i+1:],target-nums[i],count,k) ''' here when the target < 0 i want to break the loop and for example if there is array 1,2,3 and my target is 2 i will go to the loop first add 1 next again add 2 which is not