1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
var isSameTree = function (p, q) { if (!p && !q) { return true; } else if (!p || !q) { return false; } else if (p.val === q.val) { return isSameTree(p.left, q.left) && isSameTree(p.right, q.right); } return false; };
|