Given an unsorted integer array, find the first missing positive integer. For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm sh...
分类:
其他好文 时间:
2014-11-27 00:12:55
阅读次数:
338
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.public class Solution { public String int...
分类:
其他好文 时间:
2014-11-26 23:57:48
阅读次数:
330
Propagating treeTime Limit: 2000msMemory Limit: 262144KBThis problem will be judged onCodeForces. Original ID:383C64-bit integer IO format:%I64d Java ...
分类:
其他好文 时间:
2014-11-26 23:56:20
阅读次数:
388
The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other.Given an integer n, return all d...
分类:
其他好文 时间:
2014-11-26 23:55:34
阅读次数:
166
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/41521063
通过本文你可能会学到的知识为:
(1)对基本数据类型int的最大、最小边界以及Character类的isDigit()方法有所了解。
(2)对将一个字符串转换为整形可能出现的多种情况的学习。
(3)通过算法提高自己分析问题的能力,力求考虑到尽可能多的情况。
注:
(1)int对应取值范围为-2147483648~ 2147483647
(2)...
分类:
编程语言 时间:
2014-11-26 22:47:17
阅读次数:
359
Divide two integers without using multiplication, division and mod operator.思路:这道题属于数值处理的题目,对于整数处理的问题,在Reverse Integer中我有提到过,比较重要的注意点在于符号和处理越界的问题。对于这道...
分类:
其他好文 时间:
2014-11-26 22:30:20
阅读次数:
191
Implement pow(x,n).思路:像string to integer一样。考虑的细节较多。 1.测试用例要考虑基数和指数都为正数、负数和零的情况。 2.注意0的0次方在数学上没有意义。 3.用位运算代替乘除和求余优化效率:移位代替除法(n>>1 == n /2);用位与代替求...
分类:
其他好文 时间:
2014-11-26 22:15:49
阅读次数:
182
BackgroundThe digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that dig...
分类:
其他好文 时间:
2014-11-26 20:37:15
阅读次数:
145
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 (size that is greater or equal to m + n) to hold additional elements from ...
分类:
其他好文 时间:
2014-11-26 16:29:34
阅读次数:
164
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.之前那篇文章写的是罗马数字转化成整数(http://www.cnblogs.com/gr...
分类:
其他好文 时间:
2014-11-26 16:20:50
阅读次数:
244