We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
给你一个整数数组 nums ,数组中的元素 互不相同 。返回该数组所有可能的 子集 (幂集)。
解集 不能 包含重复的子集。你可以按 任意顺序 返回解集。
示例 1:
输入:nums = [1,2,3] 输出:[[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]
示例 2:
输入:nums = [0] 输出:[[],[0]]
The text was updated successfully, but these errors were encountered:
/** * @param {number[]} nums * @return {number[][]} */ var subsets = function (nums) { const result = []; const len = nums.length; function backtrack(startIndex,path) { result.push(path); for (let i = startIndex; i < len; i++) { backtrack(i + 1,[...path,nums[i]]); } } backtrack(0,[]); return result; };
Sorry, something went wrong.
No branches or pull requests
给你一个整数数组 nums ,数组中的元素 互不相同 。返回该数组所有可能的
子集
(幂集)。
解集 不能 包含重复的子集。你可以按 任意顺序 返回解集。
示例 1:
示例 2:
The text was updated successfully, but these errors were encountered: