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-12-03 18:57:09
阅读次数:
143
今天CSDN博客发生异常,折腾了大半天终于发出了这篇博文。
【题目】
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 no...
分类:
其他好文 时间:
2014-12-03 17:14:52
阅读次数:
219
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?/** * Definition for singly-linked list. *...
分类:
其他好文 时间:
2014-12-03 13:54:01
阅读次数:
152
Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.For exampl...
分类:
其他好文 时间:
2014-12-03 13:48:35
阅读次数:
151
Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space?开始以为这道题只需要注意不使用额外空间即可,于是写了个时间复杂度为O(n^2)暴力...
分类:
其他好文 时间:
2014-12-02 14:56:30
阅读次数:
177
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.
For example:
Given the below binary tree and sum...
分类:
其他好文 时间:
2014-12-01 22:37:27
阅读次数:
146
Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.For exampl...
分类:
其他好文 时间:
2014-11-30 23:04:01
阅读次数:
183
Determine whether an integer is a palindrome. Do this without extra space.Some hints:Could negative integers be palindromes? (ie, -1)If you are thinki...
分类:
其他好文 时间:
2014-11-30 22:55:07
阅读次数:
272
Linked List CycleGiven a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?SOLUTION 1:经典快慢指针问题。如果存在环...
分类:
其他好文 时间:
2014-11-30 00:15:56
阅读次数:
262
Balanced Binary TreeGiven a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tre...
分类:
其他好文 时间:
2014-11-29 17:33:54
阅读次数:
169