Dev
Mentor
Coach Interview AI
Mock Interview AI
Coding Problems
Blog
Pricing
Toggle theme
Sign In
Get Started
Toggle theme
Loading...
For the best coding experience, use a desktop browser.
Easy
Tree
Same Tree
Check if two binary trees are identical.
Examples
Input:
p = [1,2,3], q = [1,2,3]
Output:
true
Sample Test Cases
Case 1 Input:
[1,2,3] [1,2,3]
Expected:
true
Case 2 Input:
[1,2] [1,null,2]
Expected:
false
Reset
Run
Submit
Loading editor...
Test Case
Output
Submission
Case 1 Input:
[1,2,3] [1,2,3]
Expected:
true
Case 2 Input:
[1,2] [1,null,2]
Expected:
false