aboutsummaryrefslogtreecommitdiffstats
path: root/104
diff options
context:
space:
mode:
Diffstat (limited to '104')
-rw-r--r--104/go.mod3
-rw-r--r--104/main.go30
2 files changed, 33 insertions, 0 deletions
diff --git a/104/go.mod b/104/go.mod
new file mode 100644
index 0000000..da7c5c1
--- /dev/null
+++ b/104/go.mod
@@ -0,0 +1,3 @@
+module 104
+
+go 1.19
diff --git a/104/main.go b/104/main.go
new file mode 100644
index 0000000..d2646d1
--- /dev/null
+++ b/104/main.go
@@ -0,0 +1,30 @@
+package main
+
+import "fmt"
+
+type TreeNode struct {
+ Val int
+ Left *TreeNode
+ Right *TreeNode
+}
+
+func max(a, b int) int {
+ if a > b {
+ return a
+ }
+ return b
+}
+
+func maxDepth(root *TreeNode) int {
+ if root == nil {
+ return 0
+ }
+ ldepth := maxDepth(root.Left)
+ rdepth := maxDepth(root.Right)
+
+ return max(ldepth, rdepth) + 1
+}
+
+func main() {
+ fmt.Println("vim-go")
+}