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],则说明该子集已经存在,直接返回

代码

相似题目

Jetpack ViewModel源码及原理解析Leetcode_剑指Offer_II_024-反转链表
Loading...