https://oj.leetcode.com/problems/excel-sheet-column-number/publicclassSolution{
publicinttitleToNumber(Strings){
if(s==null||s.isEmpty())
return0;//invalidinput
char[]chars=s.toCharArray();
intr=0;
for(charc:chars)
{
r=r*26+(c-‘A‘)+1;
}
returnr;
}
}
分类:
其他好文 时间:
2015-01-09 19:31:16
阅读次数:
170
https://oj.leetcode.com/problems/factorial-trailing-zeroes/publicclassSolution{
publicinttrailingZeroes(intn){
if(n<=0)
return0;//Invalidinput.
//Howmany5s,25s,125s...
intbase=5;
intfives=0;
do
{
fives+=n/d;
base*=5;
}
while(base<=n);
returnfives;
}
}
分类:
其他好文 时间:
2015-01-09 19:29:55
阅读次数:
171
https://oj.leetcode.com/problems/majority-element/publicclassSolution{
publicintmajorityElement(int[]num){
intlen=num.length;
intminhit=(len/2)+1;
Map<Integer,Integer>map=newHashMap<>();
for(inti:num)
{
Integeroccur=map.get(i);
if(occur==null)
..
分类:
其他好文 时间:
2015-01-09 19:29:48
阅读次数:
167
https://oj.leetcode.com/problems/binary-tree-upside-down/http://blog.csdn.net/xudli/article/details/42362441/**
*Definitionforbinarytree
*publicclassTreeNode{
*intval;
*TreeNodeleft;
*TreeNoderight;
*TreeNode(intx){val=x;}
*}
*/
publicclassSolution{
publicT..
分类:
其他好文 时间:
2015-01-09 19:29:33
阅读次数:
169
应用启动正常,但无法进入登录页面:The webpage cannot be found HTTP 404 ... No known changes had been made and the Middle-Tier Services appear to start without problems...
分类:
其他好文 时间:
2015-01-09 18:55:09
阅读次数:
191
https://oj.leetcode.com/problems/maximum-product-subarray/http://blog.csdn.net/linhuanmars/article/details/39537283publicclassSolution{
publicintmaxProduct(int[]A)
{
if(A==null||A.length==0)
return0;
intlocalmin=1;
intlocalmax=1;
intglobal=Integer.MIN_VALU..
分类:
其他好文 时间:
2015-01-09 17:39:33
阅读次数:
127
https://oj.leetcode.com/problems/reverse-words-in-a-string/http://blog.csdn.net/linhuanmars/article/details/20982463publicclassSolution{
publicStringreverseWords(Strings){
//SolutionA:
returnreverseWords_Char(s);
//SolutionB:
//returnreverseWords_Split(s..
分类:
其他好文 时间:
2015-01-09 17:36:11
阅读次数:
134
https://oj.leetcode.com/problems/gas-station/http://blog.csdn.net/linhuanmars/article/details/22706553publicclassSolution{
publicintcanCompleteCircuit(int[]gas,int[]cost){
intlen=gas.length;
//Costifrunallstations
intallcost=0;
//Startpoint
intstart=0;
..
分类:
其他好文 时间:
2015-01-09 01:54:44
阅读次数:
161
https://oj.leetcode.com/problems/clone-graph/http://blog.csdn.net/linhuanmars/article/details/22715747/**
*Definitionforundirectedgraph.
*classUndirectedGraphNode{
*intlabel;
*List<UndirectedGraphNode>neighbors;
*UndirectedGraphNode(intx){label=x;neig..
分类:
其他好文 时间:
2015-01-09 01:53:41
阅读次数:
170
https://oj.leetcode.com/problems/word-break-ii/http://blog.csdn.net/linhuanmars/article/details/22452163publicclassSolution{
publicList<String>wordBreak(Strings,Set<String>dict)
{
//SolutionA:
//returnwordBreak_NP(s,dict);
//SolutionB:
return..
分类:
其他好文 时间:
2015-01-09 01:52:58
阅读次数:
160