leetcode90subsetii
来源:互联网 发布:网络吃火锅是什么意思 编辑:程序博客网 时间:2024/05/17 07:22
class Solution(object):
def subsetsWithDup(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
nums.sort()
res=[]
line=[]
self.helper(nums,res,line)
return res
def helper(self,nums,res,line):
res.append([x for x in line])
for i,x in enumerate(nums):
if i>0 and nums[i]==nums[i-1]:
continue
line.append(x)
self.helper(nums[i+1:],res,line)
line.pop()
def subsetsWithDup(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
nums.sort()
res=[]
line=[]
self.helper(nums,res,line)
return res
def helper(self,nums,res,line):
res.append([x for x in line])
for i,x in enumerate(nums):
if i>0 and nums[i]==nums[i-1]:
continue
line.append(x)
self.helper(nums[i+1:],res,line)
line.pop()
0 0
- leetcode90subsetii
- HoloLens开发——Hololens Spatial mapping(空间映射)中移动子模型后父模型移动的实现方法
- leetcode78subset
- 二叉树操作(面试必备)
- redis集群客户端JedisCluster优化
- WinHttp之获取网站首页源码2
- leetcode90subsetii
- Scala嵌套方法
- 简易Http工具类
- 详解Java8特性之方法引用
- Unity3d android 通信之 unity3d读取android SD卡文件
- 深度学习与人脸识别系列(2)__基于VGGNet的人脸识别系统
- CF#804 B. Minimum number of steps(字符串,思维)
- FL2440——Gadget驱动实现模拟U盘功能
- Java学习笔记---多线程同步的五种方法