题目:
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...
分类:
其他好文 时间:
2015-03-20 22:03:10
阅读次数:
125
problem:
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...
分类:
其他好文 时间:
2015-03-19 22:08:16
阅读次数:
105
Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.For exampl...
分类:
其他好文 时间:
2015-03-19 20:07:55
阅读次数:
122
WordBreak题目Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, given
s = “leetcode”,
dict = [...
分类:
其他好文 时间:
2015-03-18 21:46:10
阅读次数:
127
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...
分类:
其他好文 时间:
2015-03-18 15:20:00
阅读次数:
131
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 arr...
分类:
其他好文 时间:
2015-03-18 14:04:10
阅读次数:
103
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan...
分类:
其他好文 时间:
2015-03-18 12:07:14
阅读次数:
111
Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?runner 问题,注意while循环的条件。 1 /** 2 * Definit....
分类:
其他好文 时间:
2015-03-18 06:27:32
阅读次数:
114
problem:
Determine whether an integer is a palindrome. Do this without extra space.
click to show spoilers.
Some hints:
Could negative integers be palindromes? (ie, -1)
If you are thinking of conv...
分类:
其他好文 时间:
2015-03-17 22:00:59
阅读次数:
163
Given a linked list, determine if it has a cycle in it.判断某个链表是否有环。方法一:用一个hashmap来存放访问过的节点,通过比较当前节点是否存在map中来判断是否有环:/** * Definition for singly-linked l...
分类:
其他好文 时间:
2015-03-17 21:45:57
阅读次数:
131