当前位置:网站首页>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)
边栏推荐
猜你喜欢
随机推荐
网络安全之防火墙
转载fstream,ifstream的详细用法
ORACLE system table space SYSTEM is full and cannot expand table space problem solving process
Analysis of the investment value of domestic digital collections
cesium add point, move point
One step ahead, don't miss it again, the chain reading APP will be launched soon!
微信小程序-小程序的宿主环境
LeetCode 1351.统计有序矩阵中的负数(简单)
win12 modify dns script
shell脚本中利用sqlplus操作数据库
符号表
I use this recruit let the team to improve the development efficiency of 100%!
[Notes] Collection Framework System Collection
细说MySql索引原理
impdp import data
卷积神经网络(CNN)实现mnist手写数字识别
深度学习TensorFlow入门环境配置
菜谱小程序源码免费分享【推荐】
LeetCode 292.Nim 游戏(简单)
pytorch-09.多分类问题