
递归
终止条件;返回值;一次递归操作。
csdnzhaocsdn
先通俗易懂
再简洁高效
菜但步履不停
所有文章只是学习用没有任何商业盈利若侵权我删
展开
-
144. 二叉树的前序遍历
给定一个二叉树,返回它的 前序 遍历。示例:输入: [1,null,2,3]12/3输出: [1,2,3]进阶: 递归算法很简单,你可以通过迭代算法完成吗?来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/binary-tree-preorder-traversal著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请...原创 2020-02-07 15:28:34 · 105 阅读 · 0 评论 -
94. 二叉树的中序遍历
给定一个二叉树,返回它的中序 遍历。示例:输入: [1,null,2,3]12/3输出: [1,3,2]进阶: 递归算法很简单,你可以通过迭代算法完成吗?来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/binary-tree-inorder-traversal著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明...原创 2020-02-07 15:05:11 · 75 阅读 · 0 评论 -
234. Palindrome Linked List
Given a singly linked list, determine if it is a palindrome.Example 1:Input: 1->2Output: falseExample 2:Input: 1->2->2->1Output: trueFollow up:Could you do it in O(n) time and O(1)...原创 2020-02-02 15:15:30 · 119 阅读 · 0 评论 -
257. 二叉树的所有路径
给定一个二叉树,返回所有从根节点到叶子节点的路径。说明: 叶子节点是指没有子节点的节点。示例:输入:1/ 2 35输出: [“1->2->5”, “1->3”]解释: 所有根节点到叶子节点的路径为: 1->2->5, 1->3来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/...原创 2020-01-31 22:53:28 · 162 阅读 · 0 评论 -
112. 路径总和
给定一个二叉树和一个目标和,判断该树中是否存在根节点到叶子节点的路径,这条路径上所有节点值相加等于目标和。说明: 叶子节点是指没有子节点的节点。示例:给定如下二叉树,以及目标和 sum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ \ 7 2 ...原创 2020-01-31 22:31:26 · 86 阅读 · 0 评论 -
110. Balanced Binary Tree
Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as:a binary tree in which the left and right subtrees of every node differ in heigh...原创 2020-01-31 17:56:23 · 69 阅读 · 0 评论