Leetcode 98 Validate Binary Search Tree
摘要:Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only n...
阅读全文
posted @
2015-07-03 13:23
又岸
阅读(316)
推荐(0)
leetcode 101 Symmetric Tree
摘要:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ ...
阅读全文
posted @
2015-06-19 09:11
又岸
阅读(146)
推荐(0)
Leetcode 94 Binary Tree Inorder Traversal
摘要:Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note...
阅读全文
posted @
2015-06-17 12:40
又岸
阅读(136)
推荐(0)
leetcode 100 Same Tree
摘要: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 an...
阅读全文
posted @
2015-06-12 09:20
又岸
阅读(199)
推荐(0)
leetcode 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 depth...
阅读全文
posted @
2015-06-11 10:05
又岸
阅读(146)
推荐(0)
Leetcode 129 Sum Root to Leaf Numbers
摘要:/** * ID: 129 * Name: Sum Root to Leaf Numbers * Data Structure: * Time Complexity: * Space Complexity: * Tag: Tree * Difficult: Medium * Algorithm...
阅读全文
posted @
2015-06-04 08:15
又岸
阅读(102)
推荐(0)
Leetcode 109 Convert Sorted List to Binary Search Tree
摘要:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.主要想好返回值,每层的返回的东西思路一: 就是要每次遍历两遍来找中间值。思路二: ...
阅读全文
posted @
2015-04-24 13:04
又岸
阅读(109)
推荐(0)
Leetcode 112 Path Sum
摘要: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.Fo...
阅读全文
posted @
2015-04-17 07:20
又岸
阅读(78)
推荐(0)