Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321此题注意边界条件 -2^31 10 || (s.length() == 10 && s[0] > '2')) return ....
分类:
其他好文 时间:
2015-04-12 11:58:33
阅读次数:
154
Title :Determine whether an integer is a palindrome. Do this without extra space.思路1 : 将数字翻转,然后看是否相等。是否越界的问题,如果真是回文串是不会越界的class Solution {public: i...
分类:
其他好文 时间:
2015-04-12 11:52:10
阅读次数:
99
Given an integer n, return the number of trailing zeroes in n!.
Note: Your solution should be in logarithmic time complexity.
思路:对于一个数的阶乘后面有多少个0,一个数 n 的阶乘末尾有多少个 0 取决于从 1 到 n 的各个数的因子中 2 和 5 的个数,...
分类:
其他好文 时间:
2015-04-12 10:41:36
阅读次数:
118
Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet.
For example:
1 -> A
2 -> B
3 -> C
...
26 -> Z
2...
分类:
其他好文 时间:
2015-04-12 00:05:29
阅读次数:
169
Description: Given two sorted integer arrays A and B, merge B into A as one sorted array. Note: You may assume that A has enough space (siz...
分类:
其他好文 时间:
2015-04-11 23:50:26
阅读次数:
137
大家好,很高兴在这里跟大家分享下rocketmq源码实现,如有不对的地方欢迎指正。Namesrv顾名思义就是名称服务,是没有状态可横向扩展的服务。废话不多说了,直接贴代码。。1,入口函数NamesrvStartup.main01.1System.setProperty(RemotingCommand.RemotingVersionKey,Integer.toS..
分类:
其他好文 时间:
2015-04-11 21:02:28
阅读次数:
397
Determine whether an integer is a palindrome. Do this without extra space.看到题目第一想法是将数字倒过来相减,看是否为0,但是会超时。原因是大部分可能并不是,所以循环中间就退出循环了。目前这个程序是按最左位与最右位逐次比较。代...
分类:
其他好文 时间:
2015-04-11 20:39:13
阅读次数:
115
只要做过之前的那个Integer To Roman, 这个就不会很难啦~ 掌握转换规律, 建个table就OK了
"""
Programmer : EOF
Date : 2015.04.11
File : rti.py
E-mail : jasonleaster@gmail.com
"""
class Solution:
# @r...
分类:
其他好文 时间:
2015-04-11 19:32:28
阅读次数:
283
Buy the souvenirsTime Limit: 1000msMemory Limit: 32768KBThis problem will be judged onHDU. Original ID:212664-bit integer IO format:%I64d Java class n...
分类:
其他好文 时间:
2015-04-11 19:15:25
阅读次数:
142
Determine whether an integer is a palindrome. Do this without extra space.
click to show spoilers.
Some hints:
Could negative integers be palindromes? (ie, -1)
If you are thinking of convertin...
分类:
其他好文 时间:
2015-04-11 18:02:02
阅读次数:
123