题目:Given a stringsand a dictionary of wordsdict, add spaces insto construct a sentence where each word is a valid dictionary word.Return all such poss...
分类:
编程语言 时间:
2015-05-26 12:03:12
阅读次数:
162
Find thekth largest element in an unsorted array.For example,Given[3,2,1,5,6,4]and k = 2, return 5.Note:You may assume k is always valid, 1 ≤ k ≤ arra...
分类:
其他好文 时间:
2015-05-23 12:50:52
阅读次数:
134
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...
分类:
其他好文 时间:
2015-05-22 10:59:39
阅读次数:
84
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the c...
分类:
其他好文 时间:
2015-05-22 09:24:19
阅读次数:
100
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...
分类:
编程语言 时间:
2015-05-21 22:32:43
阅读次数:
187
三次9*9 循环,效率不高吧
class Solution:
# @param {character[][]} board
# @return {boolean}
def isValidSudoku(self, board):
if len(board)!=9 or len(board[0])!=9:
return False...
分类:
其他好文 时间:
2015-05-21 19:34:32
阅读次数:
130
很简单的字符串匹配问题,直接用栈就可以实现,为使程序更加高效,当要匹配的字符种类比较多的时候可以考虑用HashMap来保存匹配对...
分类:
其他好文 时间:
2015-05-21 10:55:47
阅读次数:
100
Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example:Given "25525511135",return ["25...
分类:
编程语言 时间:
2015-05-20 23:46:09
阅读次数:
157
1 class Solution { 2 public: 3 bool isNumber(string s) { 4 if(s == " ") return false; 5 int i = 0; 6 int j = s.size()-1; 7 while(s[i]...
分类:
其他好文 时间:
2015-05-20 17:56:04
阅读次数:
131
ZOJ3861 ,Valid Pattern Lock,搜索,dfs,ACM...
分类:
其他好文 时间:
2015-05-19 10:52:44
阅读次数:
143