urlname
type
Post
password
SyncToConfluence
category
Leetcode
date
Feb 28, 2023 12:30
slug
f68a2ef789f4
icon
Button
catalog
summary
tags
Algorithm
DFS
cover
Status
BusyTime
Status 1
status
Published
题目链接
关键词
{% label DFS yellow %}、{% label 排列组合 blue %}
解析
先排序 对于每一个位置上的数,都有选和不选两种选择 用一个pre变量,来表示前面一位的数字有没有选 如果 !pre && index > 0 && nums[index] == nums[index - 1],则说明该子集已经存在,直接返回
代码
相似题目
- Author:CoderWdd
- URL:https://www.wuinsights.top//article/f68a2ef789f4
- Copyright:All articles in this blog, except for special statements, adopt BY-NC-SA agreement. Please indicate the source!
Relate Posts