Skip to content

Commit 1b13dc4

Browse files
committed
Contest
1 parent 8fc7384 commit 1b13dc4

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

965_univalued_binary_tree.scala

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
object Solution {
2+
def isUnivalTree(root: TreeNode, value: Int = -1): Boolean = {
3+
if (root == null) true
4+
else (if (value >= 0) (value == root.value) else true) && isUnivalTree(root.left, root.value) && isUnivalTree(root.right, root.value)
5+
}
6+
}

0 commit comments

Comments
 (0)