PreSum template

By | May 3, 2021
Share the joy
  •  
  •  
  •  
  •  
  •  
  •  

HashMap
targetSum
currSum

for (int n : nums) {
1. see if currSum satisfy
2. count number of targetSum
3. put currSum into map.
}

In this case, it can handle [0, 0, 0], targetSum = 0, which returns 5.

practice https://leetcode.com/problems/path-sum-iii/