Google Interview Question for Software Engineer / Developers
- 1of 1 vote
Given two binary trees ( not BST) , return true if both of them have same inorder else return false.
B / \ A C
A \ B \ C
Both of the trees have same inorder ( A-B-C) hence function will return true- Anonymous April 25, 2015 in United States
Please note, we can write inorder method call it once for first tree and then second tree, and finally compare both inorder.
We want to parallely do inorder on both tree, if there is mismatch between inorder nodes of both trees, we can stop the traversal and return false
| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Trees and Graphs
Interview Type: In-Person
Open Chat in New Window