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...
分类:
其他好文 时间:
2014-11-08 13:35:55
阅读次数:
144
Follow up for "Search in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Write a function to determine if a given target is in the...
分类:
其他好文 时间:
2014-11-07 19:10:51
阅读次数:
161
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...
分类:
其他好文 时间:
2014-11-06 19:27:14
阅读次数:
227
Description
There are no days and nights on byte island, so the residents here can hardly determine the length of a single day. Fortunately, they have invented a clock with several pointers. They h...
分类:
其他好文 时间:
2014-11-06 00:50:44
阅读次数:
176
这几天A的都是二叉树的,如果输的基本操作掌握了,用递归很好解决这些题目的。这个可能不是最好的解法,明天再去Discuss看看有没有好的解法Balanced Binary TreeGiven a binary tree, determine if it is height-balanced.For t...
分类:
其他好文 时间:
2014-11-05 22:57:24
阅读次数:
261
leetcode 原题 :(即判断二叉树是否为二叉查找树)Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subt...
分类:
编程语言 时间:
2014-11-05 22:54:17
阅读次数:
204
题目描述:
Determine whether an integer is a palindrome. Do this without extra space.
代码:
bool Solution::isPalindrome(int x)
{
int a = x;
int b = 0;
while(a > 0)
{
b = b * ...
分类:
其他好文 时间:
2014-11-05 21:35:26
阅读次数:
167
题目描述:
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
For example,
"A man, a plan, a canal: Panama" is a palindrome.
"race a car...
分类:
其他好文 时间:
2014-11-05 21:30:46
阅读次数:
160
Valid PalindromeGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a pla...
分类:
其他好文 时间:
2014-11-05 21:22:45
阅读次数:
130
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
The brackets must close in the correct order, "()" and "()[]{}" are all valid bu...
分类:
其他好文 时间:
2014-11-05 09:21:15
阅读次数:
171