https://oj.leetcode.com/problems/multiply-strings/http://blog.csdn.net/linhuanmars/article/details/20967763importjava.math.BigInteger;
publicclassSolution{
publicStringmultiply(Stringnum1,Stringnum2)
{
//SolutionB:
//returnmultiply_Cheating(num1,num2);
//..
分类:
其他好文 时间:
2015-01-03 13:24:48
阅读次数:
158
昨天撸代码的时候发现了一个问题就是类型的转换,当时我的是从string转化为int型,然后试了(int)这种强制类型转化!
Doesn't work!
我擦!居然不行?!好吧,正常情况是,就是不行~
肿么办?找到了一个神器!stringstream,这个类是最近才加到编译器里面去的。所以想用这个的童鞋先升级IDE哈!
好吧,废话那么多!直接说使用方法吧!
网上给的都是用
strings...
分类:
其他好文 时间:
2015-01-03 09:26:14
阅读次数:
151
https://oj.leetcode.com/problems/longest-substring-without-repeating-characters/http://fisherlei.blogspot.com/2012/12/leetcode-longest-substring-without.htmlpublicclassSolution{
publicintlengthOfLongestSubstring(Strings){
if(s==null||s.isEmpty())
return0;/..
分类:
其他好文 时间:
2015-01-02 16:16:01
阅读次数:
119
https://oj.leetcode.com/problems/longest-palindromic-substring/http://fisherlei.blogspot.com/2012/12/leetcode-longest-palindromic-substring.htmlpublicclassSolution{
publicStringlongestPalindrome(Strings){
//SolutionA:
returnlongestPalindrome_Center(s);
}
..
分类:
其他好文 时间:
2015-01-02 16:15:08
阅读次数:
122
https://oj.leetcode.com/problems/roman-to-integer/http://fisherlei.blogspot.com/2012/12/leetcode-roman-to-integer.html//Symbol Value
//I 1
//V 5
//X 10
//L 50
//C 100
//D 500
//M 1,000
publicclassSolution{
publicintromanToInt(Strings){
Map<Character,In..
分类:
其他好文 时间:
2015-01-02 16:13:57
阅读次数:
163
https://oj.leetcode.com/problems/zigzag-conversion/http://fisherlei.blogspot.com/2013/01/leetcode-zigzag-conversion.htmlpublicclassSolution{
publicStringconvert(Strings,intnRows){
//SolutionA:
returnconvert_NoNewMatrix(s,nRows);
}
////////////////////////..
分类:
其他好文 时间:
2015-01-02 16:13:47
阅读次数:
140
https://oj.leetcode.com/problems/valid-parentheses/http://fisherlei.blogspot.com/2013/01/leetcode-valid-parentheses.htmlpublicclassSolution{
publicbooleanisValid(Strings)
{
if(s==null)
returntrue;
Stack<Character>stack=newStack<>();
for(charc:s..
分类:
其他好文 时间:
2015-01-02 16:12:14
阅读次数:
99
One Edit Distance
Total Accepted: 709
Total Submissions: 3097
Given two strings S and T, determine if they are both one edit distance apart.
[分析]
delete, add, replace 三种都是 One edit dista...
分类:
其他好文 时间:
2015-01-02 14:43:29
阅读次数:
183
Palindrome Partitioning IIGiven a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a p...
分类:
其他好文 时间:
2015-01-01 16:00:58
阅读次数:
164
Given two strings, find the longest comment subsequence (LCS).Your code should return the length of LCS.ExampleFor "ABCD" and "EDCA", the LCS is "A" (...
分类:
其他好文 时间:
2015-01-01 00:12:17
阅读次数:
122