Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/Tiwarishashwat/InterviewCodes
/ dfs
Method
dfs
FindElementsInAContaminatedBinaryTree.java:26–32 ·
view source on GitHub ↗
(TreeNode root, int val)
Source
from the content-addressed store, hash-verified
24
25
}
26
public
void
dfs(TreeNode root,
int
val){
27
if
(root==null)
return
;
28
root.val = val;
29
set.add(val);
30
dfs(root.left, 2*val+1);
31
dfs(root.right, 2*val+2);
32
}
33
}
34
35
/**
Callers
1
FindElements
Method · 0.95
Calls
1
add
Method · 0.45
Tested by
no test coverage detected