Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), return ...
分类:
其他好文 时间:
2015-03-17 19:27:15
阅读次数:
111
problem:
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
thinking:
(1)整型反转直观很容易理解。如正负,尾数为0等问题还好处理。
(2)反转溢出问题要仔细处理。
code:
class Solution {
public:
...
分类:
其他好文 时间:
2015-03-17 18:04:05
阅读次数:
132
题目非常有简单:DescriptionGiven a n × n matrix A and a positive integer k, find the sumS = A + A2 + A3 + … + Ak.OutputS mod m范围:n (n ≤ 30), k (k ≤ 109) andm ...
分类:
其他好文 时间:
2015-03-17 13:57:31
阅读次数:
117
<?php/** * 获取客户端IP * @param integer $type 返回类型 0:string,1:long * @return string|long */function getClientIp($type = 0) { $ip = NULL; if (isset(...
分类:
Web程序 时间:
2015-03-17 00:35:03
阅读次数:
238
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110...
分类:
其他好文 时间:
2015-03-16 23:16:55
阅读次数:
331
题目: Given
a binary tree, determine if it is a valid binary search tree (BST).
知识点:BST的特点:
1、一个节点的左子树的所有点都小于或等于这个点的值,右子树的所有节点的值大于该节点的值;
2、最左节点值最小,最右节点值最大;
3、中序遍历结果值是一个非降的数列
问题:如果用Integer.MAX_VAL...
分类:
其他好文 时间:
2015-03-16 23:13:11
阅读次数:
149
Write a function that takes an unsigned integer and returns the number of ’1’ bits it has (also known as the Hamming weight).For example, the 32-bit integer ’11’ has binary representation 0000000000000...
分类:
其他好文 时间:
2015-03-16 23:09:57
阅读次数:
195
1、 mapper.xml中的resultMap中的parameterType
INTEGER要大写。
中的 parameterType=”int”不是 parameterType=”Integer”
2、查询时数据库字段值如果为空,返回的结果集会有默认值
如果是Integer和String类型在实体类中,通过generator自动生成实体中已经处理了Null的情况
public Stri...
分类:
其他好文 时间:
2015-03-16 19:22:41
阅读次数:
177
Go to my personal blog
Another
program to print Fahrenheit-Celsius table with decimal integer
This program is presented
as below.
#include
/* print Fahrenheit_Celsius table
for fah...
分类:
其他好文 时间:
2015-03-16 19:22:36
阅读次数:
159
TCP keep-alive的三个参数用man命令,可以查看linux的tcp的参数:man 7 tcp其中keep-alive相关的参数有三个: tcp_keepalive_intvl (integer; default: 75; since Linux 2.4)
The number of seconds between TCP keep-alive pr...
分类:
其他好文 时间:
2015-03-16 19:19:08
阅读次数:
144