天天看點

python【力扣LeetCode算法題庫】18-四數之和

  1. 四數之和

    給定一個包含 n 個整數的數組 nums 和一個目标值 target,判斷 nums 中是否存在四個元素 a,b,c 和 d ,使得 a + b + c + d 的值與 target 相等?找出所有滿足條件且不重複的四元組。

注意:

答案中不可以包含重複的四元組。

class Solution:
    def fourSum(self, nums: List[int], target