Title: #78 - Subsets - LeetCode JavaScript Solutions
Open Graph Title: #78 - Subsets - LeetCode JavaScript Solutions
X Title: #78 - Subsets - LeetCode JavaScript Solutions
Description: Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate sub...
Open Graph Description: Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate sub...
X Description: Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate sub...
Keywords:
Opengraph URL: https://leetcodejavascript.com/solutions/subsets
Domain: leetcodejavascript.com
{"@context":"https://schema.org","@type":"Code","url":"https://leetcodejavascript.com/solutions/subsets","name":"#78 - Subsets - LeetCode JavaScript Solutions","description":"Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate sub...","programmingLanguage":"JavaScript","codeRepository":"https://github.com/JoshCrozier/leetcode-javascript","codeSampleType":"JavaScript","text":"/**\n * @param {number[]} nums\n * @return {number[][]}\n */\nvar subsets = function(nums) {\n const result = [];\n dfs([], 0);\n\n function dfs(subset, start) {\n result.push(subset);\n for (let index = start; index < nums.length; index++) {\n dfs([...subset, nums[index]], index + 1);\n }\n }\n\n return result;\n};","keywords":"LeetCode 78, #78 - Subsets, Medium, JavaScript solution","learningResourceType":"Code","isAccessibleForFree":true,"educationalLevel":"intermediate","interactivityType":"mixed"}
| author | LeetCodeJavascript.com |
| og:type | article |
| og:image | https://leetcodejavascript.com/og-image.jpg |
| og:site_name | LeetCode JavaScript Solutions |
| twitter:card | summary_large_image |
| twitter:url | https://leetcodejavascript.com/solutions/subsets |
| twitter:image | https://leetcodejavascript.com/og-image.jpg |
| twitter:creator | @joshcrozier |
| theme-color | #1f2937 |
Links:
| LeetCodeJavascript.com | https://leetcodejavascript.com/ |
| Star on GitHub | https://github.com/JoshCrozier/leetcode-javascript |
| Back to all solutions | https://leetcodejavascript.com |
| View on LeetCode | https://leetcode.com/problems/subsets/ |
| View on GitHub | https://github.com/JoshCrozier/leetcode-javascript/blob/master/solutions/0078-subsets.js |
| Array | https://leetcodejavascript.com/tags/array |
| Bit Manipulation | https://leetcodejavascript.com/tags/bit-manipulation |
| Backtracking | https://leetcodejavascript.com/tags/backtracking |
| Josh Crozier | https://joshcrozier.com |
Viewport: width=device-width, initial-scale=1.0
Robots: index, follow