Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:
其他好文 时间:
2014-06-28 23:59:00
阅读次数:
383
join(string, ...) Returns a new string formed by joining the strings using File::SEPARATOR.File.join("usr", "mail", "gumby") #=> "usr/mail/gumby"rea.....
分类:
其他好文 时间:
2014-06-21 08:28:24
阅读次数:
224
题目
Given an array of strings, return all groups of strings that are anagrams.
Note: All inputs will be in lower-case.
方法
题目中是找出所有的字符串由相同的字符组成,只是顺序不同。
public List anagrams(St...
分类:
其他好文 时间:
2014-06-19 10:46:45
阅读次数:
207
题目
Write a function to find the longest common prefix string amongst an array of strings.
方法
从第一个字符开始,判断是否相同。
public String longestCommonPrefix(String[] strs) {
if (strs ...
分类:
其他好文 时间:
2014-06-18 11:18:30
阅读次数:
205
#include #include #include char a[1000001];int next[1000001];int l;void Getnext(){ int j=-1; int i=0; next[0]=-1;//忘写了,死循环 while(i...
分类:
其他好文 时间:
2014-06-18 09:35:19
阅读次数:
138
Write a function to find the longest common prefix string amongst an array of strings.题解: 寻找一组字符串的最长公共前缀。最简单的方法,用一个字符串记录当前最长的公共前缀,然后依次比较。时间复杂度: O(N). ...
分类:
其他好文 时间:
2014-06-18 00:03:08
阅读次数:
274
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:
其他好文 时间:
2014-06-17 14:35:50
阅读次数:
297
大数相乘,分别都是用字符串表示的两个大数,求相乘之后的结果表示。
首先我们应该考虑一下测试用例会有哪些,先准备测试用例对防御性编程会有比较大的帮助,能够考虑一些极端情况。有以下几种用例:
1)"0","0"
2)"0","879127346783" 其中一个是零
3)"as234","123343" 存在非法字符
4)"000000000000001234","2546" 存在零...
分类:
其他好文 时间:
2014-06-16 21:08:24
阅读次数:
255
http://ruby-doc.org/core-2.1.2/Regexp.htmlRegexpARegexpholds a regular expression, used to match a pattern against strings. Regexps are created using ...
分类:
其他好文 时间:
2014-06-14 21:17:33
阅读次数:
304
题目
Given two numbers represented as strings, return multiplication of the numbers as a string.
Note: The numbers can be arbitrarily large and are non-negative.
方法
将num1与0-9相乘的结果存...
分类:
其他好文 时间:
2014-06-14 06:08:30
阅读次数:
229