10 2,3,4 Sums
Last updated
Was this helpful?
Last updated
Was this helpful?
这些题基本都是2 pointer。2sum和4sum的变种也会利用hashmap来加速。
(L56)
- input array is sorted (L608 Two Sum IV)
- Data structure design
- use 2 pointer to count
(L57)
(L59)
(L58)
Quad combination - pramp mock interview
- 小于等于k的count
- Unique two sum pairs(去重)
- Difference equals to target
(611 Valid Triangle Number)
Other related:
L89 k Sum - DP
L90 k Sum II - DFS
-- 还能这样2ptr
-- 感觉这题可以转化成2sum,不过这里用了个比较巧妙的解法。