Loading problem…
Given the roots of two binary trees p and q, return true if they are the same.
p
q
true
Two binary trees are considered the same if:
// Tree A: 1 // / \ // 2 3 // // Tree B: 1 // / \ // 2 3 isSameTree([1,2,3], [1,2,3]); // true // Tree A: 1 // / // 2 // // Tree B: 1 // \ // 2 isSameTree([1,2], [1,null,2]); // false isSameTree([1,2,1], [1,1,2]); // false
4 hints available with Pro