We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f4721ee commit cdeeb80Copy full SHA for cdeeb80
same-tree/hwanmini.js
@@ -0,0 +1,20 @@
1
+/**
2
+ * Definition for a binary tree node.
3
+ * function TreeNode(val, left, right) {
4
+ * this.val = (val===undefined ? 0 : val)
5
+ * this.left = (left===undefined ? null : left)
6
+ * this.right = (right===undefined ? null : right)
7
+ * }
8
+ */
9
10
+ * @param {TreeNode} p
11
+ * @param {TreeNode} q
12
+ * @return {boolean}
13
14
+var isSameTree = function(p, q) {
15
+ if ((p && !q) || (!p && q)) return false;
16
+ if (!p || !q) return true
17
+ if (p.val === q.val) return isSameTree(p.left, q.left) && isSameTree(p.right, q.right)
18
+ return false
19
+};
20
+
0 commit comments