题目

给定一个二叉树,返回它的中序 遍历。

实现

#     def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None class Solution:
def inorderTraversal(self, root: TreeNode) -> List[int]:
result = []
def inorder(tree, result):
if tree != None:
if tree.left != None:
inorder(tree.left, result)
result.append(tree.val)
if tree.right != None:
inorder(tree.right, result)
inorder(root, result)
return result

最新文章

  1. Titanium.UI.createAlertDialog
  2. Java多线程编程核心技术--定时器
  3. BZOJ4118 : [Wf2015]Window Manager
  4. 【iCore3 双核心板_FPGA】例程三:GPIO输入实验——识别按键输入
  5. windows下多个python版本共存
  6. 一、Microsoft Dynamics CRM 4.0 SDK概述
  7. Ubuntu 安装Chrome步骤
  8. 从 mian 函数开始一步一步分析 nginx 执行流程(一)
  9. Network view
  10. Goland 提示 :configuration is still incorrect 的解决
  11. 四十二、在线预览pdf文件
  12. java 实现加密算法(在网上看的,保存)
  13. Newtonsoft.Json(Json.net) 的使用
  14. linux内存源码分析 - 伙伴系统(释放页框)
  15. require/exports 与 import/export 的区别?
  16. 最长增长子序列(LIS)
  17. How to check for null/empty/whitespace values with a single test?
  18. Android Jetpack 概述
  19. Python之随机梯度下降
  20. display:inline block inline-block 的区别

热门文章

  1. Linux(Centos 7)下安装Git并配置连接GitHub
  2. 工作小记[csv文件、admin中filed与list_display区别、ModuleNotFoundError: No module named'xxx'、django创建admin用户]
  3. 2020-07-22:你觉得使用redis的主从复制的时候有什么点需要注意的吗?
  4. C#LeetCode刷题之#278-第一个错误的版本(First Bad Version)
  5. 自动化特征工程—Featuretools
  6. P、NP、NPC问题详解
  7. Mac开发工具
  8. css如何让子元素在父元素中水平垂直居中
  9. Linux中.bashrc与.bash_profile的对比
  10. GaussDB连接与登出