当前位置:网站首页>Leetcode skimming: binary tree 03 (post order traversal of binary tree)
Leetcode skimming: binary tree 03 (post order traversal of binary tree)
2022-07-02 00:26:00 【Taotao can't learn English】
145. Postorder traversal of binary trees
package com.programmercarl.tree;
import java.util.ArrayList;
import java.util.List;
/** * @ClassName PostorderTraversal * @Descriotion TODO * @Author nitaotao * @Date 2022/7/1 15:27 * @Version 1.0 * 145. Postorder traversal of binary trees * https://leetcode.cn/problems/binary-tree-postorder-traversal/ **/
public class PostorderTraversal {
public List<Integer> postorderTraversal(TreeNode root) {
List<Integer> result = new ArrayList<Integer>();
traversal(root, result);
return result;
}
/** * After the sequence traversal * @param root * @param result */
public void traversal(TreeNode root, List<Integer> result) {
// Determine termination conditions
if (root == null) {
return;
}
// Left
traversal(root.left,result);
// Right
traversal(root.right,result);
// in
result.add(root.val);
}
}

边栏推荐
- 数据库--SqlServer详解
- Node——生成微信权限验证配置
- cookie、session、tooken
- vue 强制清理浏览器缓存
- Intelligent operation and maintenance practice: banking business process and single transaction tracking
- What is ThreadLocal memory leak and how to solve it
- leetcode96不同的二叉搜索树
- [cascade classifier training parameters] training Haar cascades
- Linux CentOS7安装Oracle11g的超完美新手教程
- 在证券账户上买基金安全吗?哪里可以买基金
猜你喜欢
Linux centos7 installation Oracle11g super perfect novice tutorial

SQL数据分析之子查询的综合用法和案例题【耐心整理】

2022拼多多详情/拼多多商品详情/拼多多sku详情

How can entrepreneurial teams implement agile testing to improve quality and efficiency? Voice network developer entrepreneurship lecture Vol.03
Linux CentOS7安装Oracle11g的超完美新手教程
![Jielizhi, production line assembly link [chapter]](/img/f8/20c41ffe9468d59bf25ea49f73751e.png)
Jielizhi, production line assembly link [chapter]

2023款雷克萨斯ES产品公布,这回进步很有感

Multi table operation - one to one, one to many and many to many

Graduation season is both a farewell and a new beginning

基于全志H3的QT5.12.9移植教程
随机推荐
【QT】对于Qt MSVC 2017无法编译的问题解决
Vue force cleaning browser cache
九州云与英特尔联合发布智慧校园私有云框架,赋能教育新基建
Regular expression collection
ERP项目施行计划的目的是什么?
cookie、session、tooken
LeetCode中等题题分享(5)
Shell custom function
SQL数据分析之子查询的综合用法和案例题【耐心整理】
mysql之B tree 以及 B+tree
微信小程序缓存过期时间的相关设置(推荐)
ThreadLocal内存泄漏是什么,怎么解决
Node -- egg implements the interface of uploading files
Use the htaccess file to prohibit the script execution permission in the directory
Ldr6035 smart Bluetooth audio can be charged and released (5.9.12.15.20v) fast charging and fast releasing device charging
Take the enclave Park as a sample to see how Yuhua and Shaoshan play the song of Chang Zhu Tan integrated development
PHP reads ini or env type configuration
Windows10 install WSL (I) (wslregisterdistribution error)
Database -- sqlserver details
Cmake engineering related
