Validate Binary Search TreeGiven a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtre...
分类:
其他好文 时间:
2014-12-21 21:55:07
阅读次数:
230
题目:
Determine whether an integer is a palindrome. Do this without extra space.
分析:
该题目来源于leetcode。回文串是一个正读和反读都一样的字符串,比如“level”或者“noon”等等就是回文串。当然整数形式的回文串也是类似的。但负数不是回文串。两种思路:
按定义来,依次比较串的首尾,直到中...
分类:
其他好文 时间:
2014-12-21 20:43:45
阅读次数:
174
这个题目我采用了两种方案,第一种方案代码行数相对较少,但效率稍低,第二种方案参照网上的进行改进代码行数相对多些,但效率稍高。
题目:
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
The brack...
分类:
其他好文 时间:
2014-12-21 20:43:27
阅读次数:
202
Valid ParenthesesGiven a string containing just the characters'(',')','{','}','['and']', determine if the input string is valid.The brackets must clos...
分类:
其他好文 时间:
2014-12-20 12:50:17
阅读次数:
163
Path SumGiven 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 give...
分类:
其他好文 时间:
2014-12-18 22:11:57
阅读次数:
157
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 tr...
分类:
其他好文 时间:
2014-12-18 22:05:21
阅读次数:
180
一、原题
Linked List Cycle
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
二、分析
选用两个指针扫描链表,一个速度快,一个速度慢,若两个指针相遇,说明有环。
三、...
分类:
其他好文 时间:
2014-12-18 20:44:05
阅读次数:
157
[root@localhostbin]#./apachectlstarthttpd:Couldnotreliablydeterminetheserver‘sfullyqualifieddomainname,usinglocalhost.localdomainforServerName[root@localhostbin]#./apachectlstophttpd:Couldnotreliablydeterminetheserver‘sfullyqualifieddomainname,usinglocalhos..
分类:
Web程序 时间:
2014-12-18 19:08:27
阅读次数:
177
题目
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 node nev...
分类:
其他好文 时间:
2014-12-18 15:16:38
阅读次数:
169
标题:Balanced Binary Tree通过率:32.3%难度:简单Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is define...
分类:
其他好文 时间:
2014-12-18 14:50:55
阅读次数:
186