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 97f7c08 commit 4d9ba6bCopy full SHA for 4d9ba6b
maximum-depth-of-binary-tree/export.go
@@ -0,0 +1,8 @@
1
+package maximum_depth_of_binary_tree
2
+
3
+func Max(a, b int) int {
4
+ return max(a, b)
5
+}
6
+func MaxDepth(root *TreeNode) int {
7
+ return maxDepth(root)
8
maximum-depth-of-binary-tree/index.go
@@ -0,0 +1,19 @@
+import serialize_and_deserialize_binary_tree "github.com/masx200/leetcode-test/serialize-and-deserialize-binary-tree"
+type TreeNode = serialize_and_deserialize_binary_tree.TreeNode
+func maxDepth(root *TreeNode) int {
+ if root == nil {
9
+ return 0
10
+ } else {
11
+ return max(maxDepth(root.Left), maxDepth(root.Right)) + 1
12
+ }
13
14
+func max(a, b int) int {
15
+ if a > b {
16
+ return a
17
18
+ return b
19
0 commit comments