Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/neetcode-gh/leetcode
/ subsets
Function
subsets
javascript/0078-subsets.js:7–11 ·
view source on GitHub ↗
(nums)
Source
from the content-addressed store, hash-verified
5
* @
return
{number[][]}
6
*/
7
var
subsets = (nums) => {
8
nums.sort((a, b) => a - b);
9
10
return
dfs(nums);
11
};
12
13
var
dfs = (nums, level = 0, set = [], subset = []) => {
14
subset.push(set.slice());
Callers
nothing calls this directly
Calls
2
dfs
Function · 0.70
bfs
Function · 0.70
Tested by
no test coverage detected