MCPcopy
hub / github.com/doocs/leetcode / dfs

Method dfs

solution/0200-0299/0254.Factor Combinations/Solution.java:10–23  ·  view source on GitHub ↗
(int n, int i)

Source from the content-addressed store, hash-verified

8 }
9
10 private void dfs(int n, int i) {
11 if (!t.isEmpty()) {
12 List<Integer> cp = new ArrayList<>(t);
13 cp.add(n);
14 ans.add(cp);
15 }
16 for (int j = i; j <= n / j; ++j) {
17 if (n % j == 0) {
18 t.add(j);
19 dfs(n / j, j);
20 t.remove(t.size() - 1);
21 }
22 }
23 }
24}

Callers 1

getFactorsMethod · 0.95

Calls 4

isEmptyMethod · 0.45
addMethod · 0.45
removeMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected