Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update Go solution for 0104
  • Loading branch information
hamorrar committed Jul 6, 2025
commit a928a990efde3a44a9d5b6784bba19ddc8470a7a
9 changes: 1 addition & 8 deletions go/0104-maximum-depth-of-binary-tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,5 @@ func maxDepth(root *TreeNode) int {
return 0
}

left := maxDepth(root.Left)
right := maxDepth(root.Right)

if left > right {
return 1 + left
}

return right + 1
return 1 + max(maxDepth(root.Left), maxDepth(root.Right))
}