You are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the binary tree to any leaf. The value of a path is the sum o...
分类:
其他好文 时间:
2014-11-11 22:57:13
阅读次数:
280
Valid ParenthesesGiven a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must clos...
分类:
其他好文 时间:
2014-11-11 22:24:21
阅读次数:
201
题目描述:
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
思路:初始化一个快指针fast,一个慢指针slow。快指针一次移动两个单位,慢指针一次移动一个单位。如果链表有环,则两指针必然会相遇。否则若fas...
分类:
其他好文 时间:
2014-11-11 16:40:35
阅读次数:
208
Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space?怎样判断一个链表之中是否有环?可以利用快慢指针的方法。定义两个指针fast和slo...
分类:
其他好文 时间:
2014-11-10 23:15:29
阅读次数:
289
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-09 23:41:43
阅读次数:
201
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...
分类:
其他好文 时间:
2014-11-09 16:41:17
阅读次数:
122
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Pana...
分类:
其他好文 时间:
2014-11-09 15:07:01
阅读次数:
129
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...
分类:
其他好文 时间:
2014-11-09 06:19:31
阅读次数:
173
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-09 00:55:08
阅读次数:
250
同样的雪花时间限制:1000ms | 内存限制:65535KB难度:4描写叙述You may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this ...
分类:
其他好文 时间:
2014-11-08 20:48:27
阅读次数:
139