mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-06 23:28:29 +08:00
Update
This commit is contained in:
@ -458,6 +458,7 @@
|
||||
* [724.寻找数组的中心索引](./problems/0724.寻找数组的中心索引.md)
|
||||
* [34.在排序数组中查找元素的第一个和最后一个位置](./problems/0034.在排序数组中查找元素的第一个和最后一个位置.md) (二分法)
|
||||
* [922.按奇偶排序数组II](./problems/0922.按奇偶排序数组II.md)
|
||||
* [35.搜索插入位置](./problems/0035.搜索插入位置.md)
|
||||
|
||||
## 链表
|
||||
|
||||
|
@ -253,4 +253,4 @@ class Solution {
|
||||
* 作者微信:[程序员Carl](https://mp.weixin.qq.com/s/b66DFkOp8OOxdZC_xLZxfw)
|
||||
* B站视频:[代码随想录](https://space.bilibili.com/525438321)
|
||||
* 知识星球:[代码随想录](https://mp.weixin.qq.com/s/QVF6upVMSbgvZy8lHZS3CQ)
|
||||
<div align="center"><img src=https://code-thinking-1253855093.file.myqcloud.com/pics/20210928153539.png width=500> </img></div>
|
||||
<div align="center"><img src=https://code-thinking.cdn.bcebos.com/pics/01二维码一.jpg width=500> </img></div>
|
||||
|
@ -7,7 +7,7 @@
|
||||
<p align="center"><strong>欢迎大家<a href="https://mp.weixin.qq.com/s/tqCxrMEU-ajQumL1i8im9A">参与本项目</a>,贡献其他语言版本的代码,拥抱开源,让更多学习算法的小伙伴们收益!</strong></p>
|
||||
|
||||
|
||||
## 第78题. 子集
|
||||
# 78.子集
|
||||
|
||||
[力扣题目链接](https://leetcode-cn.com/problems/subsets/)
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
[]
|
||||
]
|
||||
|
||||
## 思路
|
||||
# 思路
|
||||
|
||||
求子集问题和[77.组合](https://programmercarl.com/0077.组合.html)和[131.分割回文串](https://programmercarl.com/0131.分割回文串.html)又不一样了。
|
||||
|
||||
@ -153,19 +153,19 @@ public:
|
||||
|
||||
并不会,因为每次递归的下一层就是从i+1开始的。
|
||||
|
||||
## 总结
|
||||
# 总结
|
||||
|
||||
相信大家经过了
|
||||
* 组合问题:
|
||||
* [回溯算法:求组合问题](https://programmercarl.com/0077.组合.html)
|
||||
* [77.组合](https://programmercarl.com/0077.组合.html)
|
||||
* [回溯算法:组合问题再剪剪枝](https://programmercarl.com/0077.组合优化.html)
|
||||
* [回溯算法:求组合总和!](https://programmercarl.com/0216.组合总和III.html)
|
||||
* [回溯算法:电话号码的字母组合](https://programmercarl.com/0017.电话号码的字母组合.html)
|
||||
* [回溯算法:求组合总和(二)](https://programmercarl.com/0039.组合总和.html)
|
||||
* [回溯算法:求组合总和(三)](https://programmercarl.com/0040.组合总和II.html)
|
||||
* [216.组合总和III](https://programmercarl.com/0216.组合总和III.html)
|
||||
* [17.电话号码的字母组合](https://programmercarl.com/0017.电话号码的字母组合.html)
|
||||
* [39.组合总和](https://programmercarl.com/0039.组合总和.html)
|
||||
* [40.组合总和II](https://programmercarl.com/0040.组合总和II.html)
|
||||
* 分割问题:
|
||||
* [回溯算法:分割回文串](https://programmercarl.com/0131.分割回文串.html)
|
||||
* [回溯算法:复原IP地址](https://programmercarl.com/0093.复原IP地址.html)
|
||||
* [131.分割回文串](https://programmercarl.com/0131.分割回文串.html)
|
||||
* [93.复原IP地址](https://programmercarl.com/0093.复原IP地址.html)
|
||||
|
||||
洗礼之后,发现子集问题还真的有点简单了,其实这就是一道标准的模板题。
|
||||
|
||||
@ -173,10 +173,10 @@ public:
|
||||
|
||||
**而组合问题、分割问题是收集树形结构中叶子节点的结果**。
|
||||
|
||||
## 其他语言版本
|
||||
# 其他语言版本
|
||||
|
||||
|
||||
Java:
|
||||
## Java
|
||||
```java
|
||||
class Solution {
|
||||
List<List<Integer>> result = new ArrayList<>();// 存放符合条件结果的集合
|
||||
@ -204,7 +204,7 @@ class Solution {
|
||||
}
|
||||
```
|
||||
|
||||
Python:
|
||||
## Python
|
||||
```python3
|
||||
class Solution:
|
||||
def subsets(self, nums: List[int]) -> List[List[int]]:
|
||||
@ -220,7 +220,7 @@ class Solution:
|
||||
return res
|
||||
```
|
||||
|
||||
Go:
|
||||
## Go
|
||||
```Go
|
||||
var res [][]int
|
||||
func subset(nums []int) [][]int {
|
||||
@ -244,7 +244,7 @@ func Dfs(temp, nums []int, start int){
|
||||
}
|
||||
```
|
||||
|
||||
Javascript:
|
||||
## Javascript:
|
||||
|
||||
```Javascript
|
||||
var subsets = function(nums) {
|
||||
@ -263,7 +263,7 @@ var subsets = function(nums) {
|
||||
};
|
||||
```
|
||||
|
||||
C:
|
||||
## C
|
||||
```c
|
||||
int* path;
|
||||
int pathTop;
|
||||
|
Reference in New Issue
Block a user