104. Maximum Depth of Binary Tree
。。没啥说的
1 public int maxDepth(TreeNode root) { 2 if(root == null) { 3 return 0; 4 } 5 return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1; 6 }
赞赏
长按二维码向我转账
受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。
已发送
发送中
微信扫一扫关注该公众号