leetcode走楼梯-leetcode:刷题总结

时间:2024-07-20 23:55:13
【文件属性】:

文件名称:leetcode走楼梯-leetcode:刷题总结

文件大小:785KB

文件格式:ZIP

更新时间:2024-07-20 23:55:13

系统开源

leetcode走楼梯 [TOC] # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None # 树的构建 root, b, c, d, e, f, g, h, i = TreeNode('A'), TreeNode('B'), TreeNode('C'), TreeNode('D'), TreeNode('E'), TreeNode('F'), TreeNode('G'), TreeNode('H'), TreeNode('I') root.left = b root.right = c b.left = d b.right = e c.left = f c.right = g f.left = h f.right = i 1.基础算法 1.1.二叉树 1.1.1.前序 根左右 # 二叉树 ## 1前序 根左右 def PreOrder1(root): # 1.1递归解法 if root == N


网友评论