leetcode之Maximum Depth of Binary Tree
来源:互联网 发布:口技box速成软件 编辑:程序博客网 时间:2024/06/05 05:08
基础的2叉树题。代码如下:
# Definition for a binary tree node.# class TreeNode(object):# def __init__(self, x):# self.val = x# self.left = None# self.right = Noneclass Solution(object): def maxDepth(self, root): """ :type root: TreeNode :rtype: int """ depth = 0 if root == None: return 0 else: return 1 + depth + max(self.maxDepth(root.right), self.maxDepth(root.left))
0 0
- LeetCode 之 Maximum Depth of Binary Tree
- LeetCode之Maximum Depth of Binary Tree
- LeetCode之Maximum Depth of Binary Tree
- leetcode 之 Maximum Depth of Binary Tree
- leetCode 之 Maximum Depth of Binary Tree
- LeetCode之Maximum Depth of Binary Tree
- leetcode之Maximum Depth of Binary Tree
- leetcode之 Maximum Depth of Binary Tree
- LeetCode之Maximum Depth of Binary Tree
- LeetCode之Maximum Depth of Binary Tree
- LeetCode 之 Maximum Depth of Binary Tree
- Leetcode - Tree - Maximum Depth of Binary Tree
- [leetcode][tree] Maximum Depth of Binary Tree
- leetcode之十Maximum Depth of Binary Tree
- LeetCode之Maximum Depth of Binary Tree(Java版)
- LeetCode之路:104. Maximum Depth of Binary Tree
- LeetCode Maximum Depth of Binary Tree
- [Leetcode] Maximum Depth of Binary Tree
- 架构探险——Android MVP模式浅析
- 五步搞定Android开发环境部署——非常详细的Android开发环境搭建教程
- VS中使用OPENMP加速
- Cocoapods 安装简单流程
- Ubuntu Nvidia driver installation
- leetcode之Maximum Depth of Binary Tree
- 24,折半查找
- struts2中的值栈ValueStack
- Gray-level Co-occurrence Matrix(灰度共生矩阵)
- Android 图片三级缓存
- Linux虚拟地址空间分布
- 行货和水货详解
- CSS进阶1: 从头到尾了解清楚 浮动 的概念
- Spring security用户验证机制浅谈.