MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / dfs

Method dfs

java/2092-find-all-people-with-secret.java:27–36  ·  view source on GitHub ↗
(int src, Map<Integer, List<Integer>> adj, Set<Integer> visit, Set<Integer> secrets)

Source from the content-addressed store, hash-verified

25 }
26
27 private void dfs(int src, Map<Integer, List<Integer>> adj, Set<Integer> visit, Set<Integer> secrets) {
28 if (visit.contains(src)) {
29 return;
30 }
31 visit.add(src);
32 secrets.add(src);
33 for (Integer nei : adj.get(src)) {
34 dfs(nei, adj, visit, secrets);
35 }
36 }
37
38 public static void main(String[] args) {
39 Solution solution = new Solution();

Callers 1

findAllPeopleMethod · 0.95

Calls 3

containsMethod · 0.45
addMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected