78. Subsets (not use befroe, so int I = start, dfs(i+1)
Previous39. Combination Sum (not use befroe, so int I = start, dfs(i) -> is i !!Next77. Combinations (not use before, so int I = start, dfs(i+1
Last updated
Last updated
subset: 元素 unique, 不使用重複數字
subset, 不允許使用重複數字
with int i = start, dfs(i+1) to next level, 下層挑選的數字必定是沒用過, 所以不會有重複
time: O(2^n) or O(2^n*n) , the subset's count is 2^n
space: O(2^n) or O(2^n*n)
why n*2^n?
this n is from where? this res.add(new ArrayList<>(list)); -> totally needs O(n)
new Array(list) is a copy op...
this total is n