Same Binary Tree
Difficulty: Easy
Acceptance: %
Points: 20.00
Two binary trees are considered the same if they are identical in structure and the nodes have the same value.
Give the root of two binary trees, check if they are the same or not.
Return 1 if they are same, else return 0.
Expected Time Complexity: O(n)
Expected Auxiliary Space: O(log n) for recursive calls.
Constraints: - 1 <= number of nodes <= 10^5
- 1 <= node->data <= 10^9
Companies: Amazon Microsoft Flipkart
Please log in to access the Submissions tab, where you can review your progress and explore code submissions from other participants.
Please log in to access the Solution tab and view detailed answers and explanations.
Please log in to access the Discussion tab and join conversations with other participants.