随笔分类 -  leetcode_dfs

摘要: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 symmet 阅读全文
posted @ 2017-10-22 17:20 daniel456 阅读(103) 评论(0) 推荐(0) 编辑
摘要:nvert a binary tree. to 方法二:BfS 阅读全文
posted @ 2017-10-22 16:52 daniel456 阅读(133) 评论(0) 推荐(0) 编辑
摘要:Find the sum of all left leaves in a given binary tree. Example: 方法二: 阅读全文
posted @ 2017-10-21 23:09 daniel456 阅读(114) 评论(0) 推荐(0) 编辑
摘要:Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longestpath betwee 阅读全文
posted @ 2017-10-21 22:37 daniel456 阅读(80) 评论(0) 推荐(0) 编辑
摘要: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. F 阅读全文
posted @ 2017-10-21 22:29 daniel456 阅读(117) 评论(0) 推荐(0) 编辑
摘要: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 l 阅读全文
posted @ 2017-10-21 22:26 daniel456 阅读(133) 评论(0) 推荐(0) 编辑
摘要: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 dept 阅读全文
posted @ 2017-10-21 22:18 daniel456 阅读(136) 评论(0) 推荐(0) 编辑
摘要:Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 题目含义:给定了一个升序的数组,转换成一个平衡二叉树 阅读全文
posted @ 2017-10-21 17:46 daniel456 阅读(116) 评论(0) 推荐(0) 编辑
摘要: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 l 阅读全文
posted @ 2017-10-21 17:37 daniel456 阅读(129) 评论(0) 推荐(0) 编辑
摘要:Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structurally identical a 阅读全文
posted @ 2017-10-21 17:14 daniel456 阅读(76) 评论(0) 推荐(0) 编辑
摘要:You are given a binary tree in which each node contains an integer value. Find the number of paths that sum to a given value. The path does not need t 阅读全文
posted @ 2017-10-21 17:13 daniel456 阅读(119) 评论(0) 推荐(0) 编辑
摘要:You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose o 阅读全文
posted @ 2017-10-20 10:41 daniel456 阅读(140) 评论(0) 推荐(0) 编辑
摘要:Given inorder and postorder traversal of a tree, construct the binary tree. 题目:给定一个树的中序排列和后续排列数组,重新绘制出该树 思路:由于后序的顺序的最后一个肯定是根,所以原二叉树的根节点可以知道,题目中给了一个很关键 阅读全文
posted @ 2017-10-16 15:44 daniel456 阅读(179) 评论(0) 推荐(0) 编辑
摘要:Given preorder and inorder traversal of a tree, construct the binary tree. Note:You may assume that duplicates do not exist in the tree. 给定一个二叉树的先序遍历和 阅读全文
posted @ 2017-10-16 15:20 daniel456 阅读(157) 评论(0) 推荐(0) 编辑
摘要:Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo 阅读全文
posted @ 2017-10-15 16:52 daniel456 阅读(128) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示