当前位置:网站首页>LeetCode 94.二叉树的中序遍历(简单)
LeetCode 94.二叉树的中序遍历(简单)
2022-08-10 05:32:00 【生信研究猿】
python 递归
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
def inorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
self.list1 = []
self.inorder(root)
return self.list1
def inorder(self,root):
p = root
if(p==None):
return
self.inorder(p.left)
self.list1.append(p.val)
self.inorder(p.right)
边栏推荐
- Set Sources Resources and other folders in the IDEA project
- 21天挑战杯MySQL-Day05
- cesium 监听地图缩放或放大来控制地图上添加的内容是否展示
- The complex "metaverse" will be interpreted for you, and the Link Reading APP will be launched soon!
- Reflection 【Notes】
- 去中心化和p2p网络以及中心化为核心的传统通信
- 2021-06-22
- transaction, storage engine
- 【List练习】遍历集合并且按照价格从低到高排序,
- 网络安全3
猜你喜欢
MySql constraints
The latest and most complete digital collection sales calendar-07.26
基于 .NET Core MVC 的权限管理系统
[Notes] Collection Framework System Collection
ORACLE system table space SYSTEM is full and cannot expand table space problem solving process
Index Notes【】【】
图片批量添加水印批量加背景缩放批量合并工具picUnionV4.0
.NET操作Excel高效低内存的开源框架 - MiniExcel
栈和队列
先人一步,不再错过,链读APP即将上线!
随机推荐
ZigBee 网络设备相关内容
idm下载器如何使用 idm下载器使用技巧
IO stream【】【】【】
Batch add watermark to pictures batch scale pictures to specified size
栈和队列
第六次实验
Set Sources Resources and other folders in the IDEA project
Chain Reading|The latest and most complete digital collection sales calendar-08.02
shell脚本中利用sqlplus操作数据库
view【】【】【】【】
你不知道的常规流
cesium 监听地图缩放或放大来控制地图上添加的内容是否展示
共识计算和激励机制
Content related to ZigBee network devices
tinymce rich text editor
el-dropdown drop-down menu style modification, remove the small triangle
The complex "metaverse" will be interpreted for you, and the Link Reading APP will be launched soon!
私有化搭建个人网盘 NextCloud
网络安全之防火墙
【List练习】遍历集合并且按照价格从低到高排序,