mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-06 23:28:29 +08:00
Merge pull request #2785 from iYaovo/fix/0046-全排列
docs:补充0046Java代码的return语句
This commit is contained in:
@ -201,6 +201,7 @@ class Solution {
|
|||||||
public void backtrack(int[] nums, LinkedList<Integer> path) {
|
public void backtrack(int[] nums, LinkedList<Integer> path) {
|
||||||
if (path.size() == nums.length) {
|
if (path.size() == nums.length) {
|
||||||
result.add(new ArrayList<>(path));
|
result.add(new ArrayList<>(path));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
for (int i =0; i < nums.length; i++) {
|
for (int i =0; i < nums.length; i++) {
|
||||||
// 如果path中已有,则跳过
|
// 如果path中已有,则跳过
|
||||||
@ -524,3 +525,4 @@ public class Solution
|
|||||||
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
<a href="https://programmercarl.com/other/kstar.html" target="_blank">
|
||||||
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
<img src="../pics/网站星球宣传海报.jpg" width="1000"/>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user