MCPcopy Create free account
hub / github.com/algorithmzuo/algorithm-journey / dfs

Method dfs

src/class136/ShowDetails.java:232–241  ·  view source on GitHub ↗
(long[] nums, int n, int i, boolean pick, long path, HashSet<Long> set)

Source from the content-addressed store, hash-verified

230 // 当前i位置的数字要或者不要全决策
231 // 收集所有可能的异或和
232 public static void dfs(long[] nums, int n, int i, boolean pick, long path, HashSet<Long> set) {
233 if (i > n) {
234 if (pick) {
235 set.add(path);
236 }
237 } else {
238 dfs(nums, n, i + 1, pick, path, set);
239 dfs(nums, n, i + 1, true, path ^ nums[i], set);
240 }
241 }
242
243}

Callers 1

printXorMethod · 0.95

Calls 1

addMethod · 0.45

Tested by

no test coverage detected