Reverse a singly linked list.click to show more hints.Hint:A linked list can be reversed either iteratively or recursively. Could you implement both?分...
分类:
其他好文 时间:
2015-05-09 01:13:01
阅读次数:
176
Implement a trie with insert, search, and startsWith methods.Note:
You may assume that all inputs are consist of lowercase letters a-z.思路:
之前也没有接触过Trie,百科上查了一下,大概就是词源的问题,N个word有公共前缀,只是后缀不同,可以用树表示。
可...
分类:
其他好文 时间:
2015-05-08 22:05:17
阅读次数:
158
Implement a trie withinsert,search, andstartsWithmethods.Note:You may assume that all inputs are consist of lowercase lettersa-z.实现字典树,没啥好说的。 1 class ...
分类:
其他好文 时间:
2015-05-08 19:54:37
阅读次数:
101
Implement a trie withinsert,search, andstartsWithmethods.Note:You may assume that all inputs are consist of lowercase lettersa-z.由于用的是 26位字母的array, 所以...
分类:
其他好文 时间:
2015-05-08 14:26:09
阅读次数:
101
题目描述:
Given an array of integers, every element appears twice except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it withou...
分类:
其他好文 时间:
2015-05-08 13:09:35
阅读次数:
112
Problem:
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the e...
分类:
编程语言 时间:
2015-05-07 22:08:33
阅读次数:
331
题目:
Implement strStr().
Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
翻译:
找到字符串的子串位置,并返回。如果没有则返回-1
思路:
通过最简单的BF遍历,如果不符合则指向下一个字符,...
分类:
其他好文 时间:
2015-05-07 18:57:09
阅读次数:
131
Reverse a singly linked list.click to show more hints.Hint:A linked list can be reversed either iteratively or recursively. Could you implement both?I...
分类:
其他好文 时间:
2015-05-07 14:20:03
阅读次数:
121
Problem:
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the pos...
分类:
编程语言 时间:
2015-05-07 12:35:08
阅读次数:
181
题目:Implement regular expression matching with support for'.'and'*'.'.' Matches any single character.'*' Matches zero or more of the preceding element....
分类:
其他好文 时间:
2015-05-07 12:10:52
阅读次数:
98