Time Limit Exceeded/*Contains Duplicate II Given an array of integers and an integer k, find out whether there there are two distinct indices i and j....
分类:
其他好文 时间:
2015-06-02 12:54:18
阅读次数:
88
Determine whether an integer is a palindrome. Do this without extra space.
本题是判断一个数是否是回文数。
代码如下:
bool isPalindrome(int x) {
int max = x;
int min = 0;
while(max >0){
...
分类:
其他好文 时间:
2015-06-02 09:26:12
阅读次数:
102
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 case...
分类:
其他好文 时间:
2015-06-02 09:25:09
阅读次数:
115
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
代码如下:
class Solution {
public:
int reverse(int x) {
if (x == -x)
{
return 0;
}
if (x < ...
分类:
其他好文 时间:
2015-06-02 00:32:52
阅读次数:
112
public int hammingWeight(int n) { String b_str = Integer.toBinaryString(n); int b_count = 0; for(int i=0; i<b_str.length(); i++) { ...
分类:
其他好文 时间:
2015-06-02 00:18:45
阅读次数:
144
Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321测试用例:123………………321-123………………-3211200………………2145134543545…………0(ove...
分类:
其他好文 时间:
2015-06-01 22:11:45
阅读次数:
123
刚开始并未考虑越界的问题,以及当个位数是0时会造成程序的错误,经过仔细审视,AC代码:int reverse(int x){ int res = 0; int temp = abs(x); int flag = 0; if (x=0 && yu>=0) { ...
分类:
其他好文 时间:
2015-06-01 18:20:02
阅读次数:
103
java.lang
类 Integer
java.lang.Object
java.lang.Number
java.lang.Integer
所有已实现的接口:
Serializable, Comparable
public final class Integer
extends Number
implements Comparable
In...
分类:
编程语言 时间:
2015-06-01 14:46:31
阅读次数:
103
1.分页SQLdeclare @pagesize integer,@cpage integer; --变量定义set @pagesize =200; --页码大小set @cpage = 5; ...
分类:
Web程序 时间:
2015-06-01 14:40:58
阅读次数:
179
Subarray SumGiven an integer array, find a subarray where the sum of numbers iszero. Your code should return the index of the first number and the ind...
分类:
其他好文 时间:
2015-06-01 13:00:46
阅读次数:
92