class Solution(object):
def subsets(self, nums):
N = len(nums)
allPossibleCombinCnt = 1 << N # 2**N
allCombin = []
for bitMask in range(allPossibleCombinCnt):
currCombin = []
for btI in range(N):
if bitMask & (1 << btI):
currCombin.append(nums[btI])
allCombin.append(currCombin)
return allCombin
Time Complexity: O(2^N)
Space Complexity: O(1)
Time Complexity: O(2^N)
Space Complexity: O(2^N)
https://www.cnblogs.com/grandyang/p/4309345.html