leetcode算法题--二叉树的深度
原题链接:https://leetcode-cn.com/problems/er-cha-shu-de-shen-du-lcof/
dfs
int maxDepth(TreeNode* root) {if (root == NULL) return 0;return max(maxDepth(root->left),maxDepth(root->right)) + 1;
}
leetcode算法题--二叉树的深度相关推荐
- leetcode算法题--二叉树中的最长交错路径★
原题链接:https://leetcode-cn.com/problems/longest-zigzag-path-in-a-binary-tree/ 嵌套递归(超时) 相关题目:二叉树中的列表 in ...
- leetcode算法题--二叉树中序遍历迭代法
原题链接:https://leetcode-cn.com/problems/binary-tree-inorder-traversal/ 二叉树中序遍历迭代法,栈实现 vector<int> ...
- leetcode算法题--二叉树中和为某一值的路径
原题链接:https://leetcode-cn.com/problems/er-cha-shu-zhong-he-wei-mou-yi-zhi-de-lu-jing-lcof/ vector< ...
- leetcode算法题--二叉树的最近公共祖先
原题链接:https://leetcode-cn.com/problems/er-cha-shu-de-zui-jin-gong-gong-zu-xian-lcof/ TreeNode* lowest ...
- leetcode算法题--二叉树的镜像
原题链接:https://leetcode-cn.com/problems/er-cha-shu-de-jing-xiang-lcof/ TreeNode* mirrorTree(TreeNode* ...
- leetcode算法题--二叉树中的伪回文路径
原题链接:https://leetcode-cn.com/problems/pseudo-palindromic-paths-in-a-binary-tree/ 这题的技巧是判断奇偶,如一条路径为[2 ...
- leetcode算法题--二叉树中的列表★
原题链接:https://leetcode-cn.com/problems/linked-list-in-binary-tree/ 嵌套递归 bool isSubPath(ListNode* head ...
- leetcode算法题--二叉树的前序遍历
题目链接:https://leetcode-cn.com/problems/binary-tree-preorder-traversal/ 二叉树前序遍历,栈实现 vector<int> ...
- leetcode算法题--二叉树的锯齿型层次遍历
题目链接: https://leetcode-cn.com/problems/binary-tree-zigzag-level-order-traversal/ https://leetcode-cn ...
最新文章
- NSA释出逆向工程工具GHIDRA针对恶意软件逆向分析
- 最近公共祖先(Lowest_Common_Ancestors)
- WebSocket学习
- 设计模式解析笔记之Adapter模式
- html 怎么置顶表格,表格(Table)表头固定,内容上滚【5个实例】
- pythonlocust使用方法_使用python的locust库进行性能测试
- 三菱fx5u编程手册_FX5U系列PLC控制伺服3种方式
- python字典添加数组_一步一步学Python3(小学生也适用) 第十三篇: 字典Dict类型
- Lintcode93 Balanced Binary Tree solution 题解
- iOS:Xcode8以下真机测试iOS10.0和iOS10.1配置包
- 自动改变文字大小和颜色的javascript效果
- Spring Data Jpa的@DynamicInsert注解和@DynamicUpdate注解
- 服务器怎么修改sqlroot密码,mysql设置更改root密码、mysql服务器的连接、mysql常用命令的图解...
- android自定义广播实现app完全退出
- 基于MC1496乘法器的AM信号调制
- Ubuntu安装客户端RabbitVCS(svn管理)
- 删除文件时出现找不到该项目 请确认该项目位置 怎么办【转】
- 小学计算机说课稿模板,小学信息技术说课稿模板
- 典型双层神经网络的正向/反向传播计算图
- 【CVPR2022】Beyond Fixation: Dynamic Window Visual Transformer
热门文章
- 怎么用python画简单的图-用python进行简单的画图操作
- python线上培训多少钱-Python人工智能在线培训班学费多少钱?
- python中的format什么意思中文-Python中format的用法
- python游戏编程入门 免费-python游戏编程入门 python游戏编程入门课
- 服务器的BIOS引导模式设置为什么,Legacy BIOS 引导模式和 UEFI 引导模式
- php语法大全下载,PHP下载文件
- es中的DiscoveryModule
- linux下查看监听端口对应的进程
- 4.11 日期/时间的程序
- hdu1042 N!