Fetching algorithms...
root = [3,4,5,1,2], subRoot = [4,1,2]
true
root = [3,4,5,1,2,null,null,null,null,0], subRoot = [4,1,2]
false
root = [1,2,3], subRoot = [2]
Time Complexity
Space Complexity
The subtree exists starting at node 4
Checking if subtree exists starting from node 3