IV. Permutations and Subsets
Back Tracing Algorithm
Subsets coding:
Permutation:
When using the above methods, think about three questions:
Array.sort()
-- remove duplicatesresult.append()
-- when output the resultif (condition): continue
-- skip condition
Difference between Subsets and Permutation:
The usage of index
, stop condition in helper
function, the time of adding levels to result.
常见的变形题:
是否能接受重复的元素,是否能接受重复的levels
大多数变型题都是permutation(排列)。
Last updated
Was this helpful?