This was asked today at Amazon interview -
Given two Binary Trees (not BST). Each node of both trees has an integer value. Validate whether both trees have the same integers, there could be repetitive integers.
Example
Tree1:
5
1 6
5 4 3 6
Tree2:
1
3 4
6 5
Output
Identical integers
Sample C/C++/Java code would be helpful.