#4Sum

LeetCode:18. 4Sum(Medium)

https://leetcode.com/problems/4sum/description/给出整数数组S[n],在数组S中是否存在a,b,c,d四个整数,使得四个数之和等于目标整数target。请找出所有满足此条件的四个整数。先对nums进行排序,然后采用两层for循环来确定前两个数字,最后在第二层for循环中确定...
代码星球 ·2021-02-12

leetcode 18-> 4Sum

 classSolution(object):deffourSum(self,nums,target):""":typenums:List[int]:typetarget:int:rtype:List[List[int]]"""l=len(nums)nums.sort()ifl<4:return[]re...
代码星球 ·2020-08-09