Question 1Reverse IntegerReverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321We need to consider a lot of cases of ...
分类:
其他好文 时间:
2015-07-19 01:19:17
阅读次数:
115
python中有一些容易忽略的不可变类型(str,integer,tuple,None)#错误演示In [45]: def demo(lst=[]): ....: lst.append("hello") ....: return lst ....: In [46]: de...
分类:
编程语言 时间:
2015-07-18 18:27:49
阅读次数:
142
Problem Definition:Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 0000001010010100000111...
分类:
其他好文 时间:
2015-07-18 15:35:15
阅读次数:
220
Problem Definition:Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For ex...
分类:
其他好文 时间:
2015-07-18 15:29:39
阅读次数:
108
装箱(inbox)和拆箱(outbox)
代表了类类型和基本类型之间的转换行为。
手动版本:
Integer b = new Integer(10);
Int a = b.intValue;
自动版本:
Integer b=30; à Integer b=new Integer(30);
Int a=b; ...
分类:
编程语言 时间:
2015-07-18 12:35:16
阅读次数:
145
【007-Reverse Integer(翻转整数)】Reverse digits of an integer. Example1: x = 123, return 321 ,Example2: x = -123, return -321 ,题目大意 输入一个整数对其进行翻转 ,解题思路 通过求余数求商法进行...
分类:
编程语言 时间:
2015-07-18 09:40:12
阅读次数:
187
public class sss { public static void main(String[] args) { Integer n1 = new Integer(47); Integer n2 = new Integer(47); System.out.println(n1 == n2); //false System.out.println(n1.equals(n2)); //t...
分类:
其他好文 时间:
2015-07-18 09:38:30
阅读次数:
90
【008-String to Integer (atoi) (字符串转成整数)】实现一个atoi函数,将字符串转成整形。要点:考虑所有的输入情况。前导字符是+或-或者没有,接下来输入的是数字,数字不能整数能表示的最大或最小数。如果超过就返回对应的最小或者最小的值。...
分类:
编程语言 时间:
2015-07-18 09:38:16
阅读次数:
173
039 Combination Sum这道题就是暴力搜索, 但是有个优化 就是 Line 14 处加一个 if a[s] > target 就不需要重复搜索 这样运行时间会从 236ms 变成108ms 1 class Solution: 2 # @param {integer[]} can...
分类:
其他好文 时间:
2015-07-18 07:07:03
阅读次数:
101
Question 1Integer to RomanGiven an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999What we need to not...
分类:
其他好文 时间:
2015-07-18 07:03:30
阅读次数:
98