100. Same Tree

Practice Same Tree for free on NudgeCode: Easy, Binary Tree pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.

Given the roots of two binary trees, return true if they have exactly the same shape and every pair of matching nodes holds the same value.

Example

p = [1,2], q = [1,null,2]  ->  false

Constraints