Merge pull request #54 from fusunx/master

添加 0078.子集.md Javascript
This commit is contained in:
Carl Sun 2021-05-13 09:12:29 +08:00 committed by GitHub
commit d25edc9e0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions

View File

@ -210,7 +210,24 @@ Python
Go
Javascript:
```Javascript
var subsets = function(nums) {
let result = []
let path = []
function backtracking(startIndex) {
result.push(path.slice())
for(let i = startIndex; i < nums.length; i++) {
path.push(nums[i])
backtracking(i + 1)
path.pop()
}
}
backtracking(0)
return result
};
```
-----------------------