Sometimes we'll want to sort a collection by something other than its natural order. For example, suppose we wanted to sort strings by their length in...
                            
                            
                                分类:
其他好文   时间:
2015-03-20 16:17:47   
                                阅读次数:
107
                             
                         
                    
                        
                            
                            
                                Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100";思路: 对齐, 计算当前位和进位;如果位较长,让我想到了先行进位加法器,不过这里的计算不...
                            
                            
                                分类:
其他好文   时间:
2015-03-20 12:35:07   
                                阅读次数:
129
                             
                         
                    
                        
                            
                            
                                publicinterfaceS{}publicinterfaceB{publicstaticfinalSs=newS(){publicStringtoString(){return"我在接口实现了";}publicvoiddoString(Strings){System.out.println("我在接口实现了");}};}publicclassTest{publicstaticvoidmain(String[]args){Strings=B.s.toString();Syste..
                            
                            
                                分类:
编程语言   时间:
2015-03-20 01:33:49   
                                阅读次数:
154
                             
                         
                    
                        
                            
                            
                                题目链接:Add Binary
Given two binary strings, return their sum (also a binary string).
For example,
a = "11"
b = "1"
Return "100".
这道题的要求是两个二进制字符串加法运算。
简单的大数加法,只不过是二进制的。处理进位的时候,按照二进制处理即可。
时间复杂度...
                            
                            
                                分类:
其他好文   时间:
2015-03-19 21:57:35   
                                阅读次数:
124
                             
                         
                    
                        
                            
                            
                                problem:
Write a function to find the longest common prefix string amongst an array of strings.
寻找 0 ~n 个字符串的最长公共前缀
thinking:
(1)公共前缀很好理解,按位匹配即可
(2)很容易忘记处理0、1个字符串的情况。
code:
string prefi...
                            
                            
                                分类:
其他好文   时间:
2015-03-18 18:05:15   
                                阅读次数:
112
                             
                         
                    
                        
                            
                            
                                packagecom.zzq;publicclassTestGoTo{/***不建议在工作使用不便于理解*但是能正常运行的*/publicstaticvoidmain(String[]args){f:f("s");}publicstaticintgetObjNumber(){returnobjNumber;}publicstaticvoidf(){System.out.println("11");}publicstaticvoidf(Strings){System.o..
                            
                            
                                分类:
编程语言   时间:
2015-03-18 06:37:59   
                                阅读次数:
141
                             
                         
                    
                        
                            
                            
                                Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.[Solution]FOR ANY string st IN strs,1...
                            
                            
                                分类:
其他好文   时间:
2015-03-17 23:19:33   
                                阅读次数:
129
                             
                         
                    
                        
                            
                            
                                [java]view plaincopyListlist=newArrayList();list.add("a1");list.add("a2");String[]toBeStored=list.toArray(newString[list.size()]);for(Strings:toBeStor...
                            
                            
                                分类:
编程语言   时间:
2015-03-17 19:55:16   
                                阅读次数:
148
                             
                         
                    
                        
                            
                            
                                标题:Palindrome Partitioning通过率:26.3%难度:中等Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible pali...
                            
                            
                                分类:
其他好文   时间:
2015-03-16 16:07:04   
                                阅读次数:
121
                             
                         
                    
                        
                            
                            
                                Longest Common Prefix问题:Write a function to find the longest common prefix string amongst an array of strings.思路: 简单的string运算我的代码:public class Soluti....
                            
                            
                                分类:
其他好文   时间:
2015-03-15 18:11:46   
                                阅读次数:
86