不为成仙,只为在这红尘中等你回来。

257. Binary Tree Paths [Easy]

    ### 题意 Given a binary tree, return all root-to-leaf paths. 给定一个二叉树,返回所有从根节点到叶子节点的路径。 Note: A leaf is a node with no children. 说明: 叶子节点是指没有子节点的节点。 Example: ``` Input: 1 / \ 2 3 \ 5 Output: ["1->2->5", "1->3"] ...

    阅读全文>>

2018年5月25日 12:15 作者:nancy 分类:[LeetCode] 273

112. Path Sum [Easy]

    ### 题意 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 sum. 给定一个二叉树和一个目标和,判断该树中是否存在根节点到叶子节点的路径,这条路径上所有节点值相加等于目标和。 Note: A leaf is a node with no...

    阅读全文>>

2018年5月25日 09:17 作者:nancy 分类:[LeetCode] 266

111. Minimum Depth of Binary Tree [Easy]

    ### 题意 Given a binary tree, find its minimum depth. 给定一个二叉树,找出其最小深度。 The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. 最小深度是从根节点到最近叶子节点的最短路径上的节点数量。 Note: A leaf is a nod...

    阅读全文>>

2018年5月24日 10:20 作者:nancy 分类:[LeetCode] 245

110. Balanced Binary Tree [Easy]

    ### 题意 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 depth of the two subtrees of every nod...

    阅读全文>>

2018年5月24日 09:57 作者:nancy 分类:[LeetCode] 254

108. Convert Sorted Array to Binary Search Tree [Easy]

    ### 题意 Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 将一个按照升序排列的有序数组,转换为一棵高度平衡二叉搜索树。 For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the tw...

    阅读全文>>

2018年5月23日 10:01 作者:nancy 分类:[LeetCode] 262

104. Maximum Depth of Binary Tree [Easy]

    ### 题意 Given a binary tree, find its maximum depth. 给定一个二叉树,找出其最大深度。 The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. 二叉树的深度为根节点到最远叶子节点的最长路径上的节点数。 Note: A leaf is a nod...

    阅读全文>>

2018年5月23日 09:44 作者:nancy 分类:[LeetCode] 240

101. Symmetric Tree [Easy]

    ### 题意 Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). 给定一个二叉树,检查它是否是镜像对称的。 For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 例如,二叉树 [1,2,2,3,4,4,3] 是对称的。 ``` 1 / \ 2 ...

    阅读全文>>

2018年5月22日 10:35 作者:nancy 分类:[LeetCode] 249

100. Same Tree [Easy]

    ### 题意 Given two binary trees, write a function to check if they are the same or not. 给定两个二叉树,编写一个函数来检验它们是否相同。 Two binary trees are considered the same if they are structurally identical and the nodes have the same value. 如果两个树在结构上相同,并且节...

    阅读全文>>

2018年5月22日 09:45 作者:nancy 分类:[LeetCode] 313