![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Recursive
我真的不会Coding
任何时候努力都不晚,要保持自信
展开
-
leetcode112. Path Sum路径之和 递归
DescriptionHintsSubmissionsDiscussSolution Pick One Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given...原创 2018-08-03 09:24:56 · 131 阅读 · 0 评论 -
存储路径:递归或者是DFSleetcode113. Path Sum II路径之和II递归DFS
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. Note: A leaf is a node with no children. Example: Given the below binary tree and sum = 22, ...原创 2018-08-03 15:20:29 · 167 阅读 · 0 评论 -
判断一棵二叉树是否是平衡二叉树
输入一棵二叉树,判断该二叉树是否是平衡二叉树。 首先,平衡二叉树的定义:/*平衡二叉搜索树(Balanced Binary Tree)具有以下性质: 它是一棵空树或它的左右两个子树的高度差的绝对值不超过1,并且左右两个子树都是一棵平衡二叉树*/ 所以我想到的是递归的方法,判断左右的高度差。 第一种方法用来判断该二叉树是否为平衡二叉树 struct TreeNo...原创 2018-08-16 10:26:54 · 286 阅读 · 0 评论