题目链接:String to Integer (atoi)
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself w...
分类:
其他好文 时间:
2015-01-28 14:44:37
阅读次数:
154
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
27 -> AA
28 -> AB
这里就是一个将...
分类:
其他好文 时间:
2015-01-28 14:37:56
阅读次数:
133
For ordering the bytes representing an object, there are two common conventions. Consider a w-bit integer having a bit representation [xw-1, xw-2, ... , x1, x0 ], where xw-1 is the most significant...
分类:
其他好文 时间:
2015-01-28 13:09:28
阅读次数:
169
Given an integer n, return the number of trailing zeroes in n!.
Note: Your solution should be in logarithmic time complexity.
题目是非常简单的,计算一个数字递归相乘后末尾0的个数
在相乘出现2*5才有可能出现0,2一般是足够的,主要是5的个数,因为是阶乘,...
分类:
其他好文 时间:
2015-01-28 13:06:21
阅读次数:
123
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for y...
分类:
其他好文 时间:
2015-01-28 10:00:47
阅读次数:
161
这个题目是把1~3999之间的整数转换为罗马数字。首先列举一下几个基本的罗马数字,1---I,5---V,10---X,50---L,100---C,500---D,1000---M。其他的罗马数字都是由这几个组成的。一个较小的单位连在较大单位前面,表示后面的减去前面的,比如CM即为900,XL即为40。我自己写了一个方法,但是比较笨拙,如下所示:
在网上看了看别人的代码,写的都很好,而...
分类:
其他好文 时间:
2015-01-28 09:58:19
阅读次数:
135
这个题目是把罗马数字转换为整数,比如输入字符串 MCMLXXXIV,输出为整数1984。观测罗马数字的规律,我们得到,其实可以直接相加每个字符代表的整数即可,比如CLIII这个罗马数字对应的整数即为100+50+1+1+1=153。但是,若是两个字符代表一个数字时,我们就需要注意了,比如IV即为5-1=4。因此,我们得到规律,没读入字符串的一个字符,都将它与之后一个字符代表的数字比较,如果前者较小...
分类:
其他好文 时间:
2015-01-28 09:57:36
阅读次数:
194
题目如下:
1005. Spell It Right (20)
时间限制
400 ms
内存限制
65536 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue
Given a non-negative integer N, ...
分类:
其他好文 时间:
2015-01-28 09:51:42
阅读次数:
170
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca...
分类:
其他好文 时间:
2015-01-28 09:46:19
阅读次数:
208
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input ca...
分类:
编程语言 时间:
2015-01-28 09:46:05
阅读次数:
231