Skip to content

Commit 7384951

Browse files
committed
Update solution 047
1 parent 7f5b3e6 commit 7384951

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

README.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
<p align="center">
2+
<a href="https://github.com/yanglbme/leetcode"><img src="http://p9ucdlghd.bkt.clouddn.com/leetcode-github.png" alt="LeetCode-GitHub"></a>
3+
</p>
14

2-
![LeetCode-GitHub](http://p9ucdlghd.bkt.clouddn.com/leetcode-github.png)
5+
<p align="center">
6+
<a href="http://makeapullrequest.com"><img src="https://img.shields.io/badge/PRs-Welcome-brightgreen.svg" alt="PRs Welcome"></a>
7+
<a href="https://github.com/yanglbme/leetcode"><img src="https://img.shields.io/badge/Lang-Java%2FPython%2FJS%2FCPP%2FGo%2F...-blue.svg" alt="Language"></a>
8+
</p>
39

4-
<center>
5-
6-
[![PRs Welcome](https://img.shields.io/badge/PRs-Welcome-brightgreen.svg)](http://makeapullrequest.com)
7-
[![Language](https://img.shields.io/badge/Lang-Java%2FPython%2FJS%2FCPP%2FGo%2F...-blue.svg)](https://github.com/yanglbme/leetcode)
8-
9-
</center>
10+
<h2 align="center">LeetCode Solution</h2>
1011

1112
## Introduction
1213
Complete solutions to Leetcode problems, updated daily.
@@ -65,4 +66,4 @@ I'm looking for long-term contributors/partners to this repo! Send me PRs if you
6566
| <center> [<img src="https://avatars3.githubusercontent.com/u/21008209?v=4" width="100px;"/><br /><sub><b>yanglbme</b></sub>](https://github.com/yanglbme)<br />[💻](https://github.com/yanglbme/leetcode/commits?author=yanglbme "Code") </center> | <center> [<img src="https://avatars3.githubusercontent.com/u/23625436?v=4" width="100px;"/><br /><sub><b>chakyam</b></sub>](https://github.com/chakyam)<br />[💻](https://github.com/yanglbme/leetcode/commits?author=chakyam "Code") </center> |
6667
|---|---|
6768

68-
<!-- ALL-CONTRIBUTORS-LIST:END -->
69+
<!-- ALL-CONTRIBUTORS-LIST:END -->

solution/047.Permutations II/README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
### 解法
1818
将数组的首元素依次与数组的每个元素交换(两元素不相等才进行交换),对于每一轮交换,对后面的数组进行递归调用。当元素只剩下一个时,添加此时的数组到 list 中。
1919

20+
注意:第 i 个数字与第 j 个数字交换时,要求[i, j) 中没有与第 j 个数字相等的数。
21+
2022
```java
2123
class Solution {
2224
public List<List<Integer>> permuteUnique(int[] nums) {
@@ -51,7 +53,7 @@ class Solution {
5153
private boolean isSwap(int[] nums, int from, int to) {
5254
for (int i = from; i < to; ++i) {
5355
if (nums[i] == nums[to]) {
54-
// 相等,不进行交换
56+
// [from, to) 中出现与 第 to 个数相等的数,返回 false,不进行交换和全排列操作
5557
return false;
5658
}
5759
}

0 commit comments

Comments
 (0)