当前位置:网站首页>LeetCode 94. Inorder Traversal of Binary Trees (Simple)
LeetCode 94. Inorder Traversal of Binary Trees (Simple)
2022-08-10 05:54:00 【Shengxin Research Ape】
python recursion
# 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 = rightclass Solution:def inorderTraversal(self, root: Optional[TreeNode]) -> List[int]:self.list1 = []self.inorder(root)return self.list1def inorder(self,root):p = rootif(p==None):returnself.inorder(p.left)self.list1.append(p.val)self.inorder(p.right)
边栏推荐
猜你喜欢
Batch add watermark to pictures batch add background zoom batch merge tool picUnionV4.0
Day1 微信小程序-小程序代码的构成
LeetCode 100.相同的树(简单)
Multi-table query Notes
链读好文:热加密存储与冷加密存储有什么区别?
IO stream【】【】【】
Ten years of sharpening a sword!The digital collection market software, Link Reading APP is officially open for internal testing!
事务、存储引擎
十年磨一剑!数字藏品行情软件,链读APP正式开放内测!
pytorch-11.卷积神经网络(高级篇)
随机推荐
链读 | 最新最全的数字藏品发售日历-07.28
One step ahead, don't miss it again, the chain reading APP will be launched soon!
事务、存储引擎
LeetCode 94.二叉树的中序遍历(简单)
Operation table Function usage
小程序wx.request简单Promise封装
[Difference between el and template]
Reflection 【Notes】
最新最全的数字藏品发售日历-07.26
【笔记】集合框架体系 Collection
The latest and most complete digital collection sales calendar-07.27
Day1 微信小程序-小程序代码的构成
堆的原理与实现以及排序
pytorch-07.处理多维特征的输入
opencv
Smart contracts and DAPP decentralized applications
Collection工具类
view【】【】【】【】
开源免费WMS仓库管理系统【推荐】
pytorch-05.用pytorch实现线性回归