码迷,mamicode.com
首页 >  
搜索关键字:integer division    ( 15415个结果
LeetCode:Divide Two Integers
Divide two integers without using multiplication, division and mod operator. 其实刚开始看到这道题的时候,感觉应该是略简单。但真正开始写的时候发现了很多错误。 最开始的想法就是divisor一个一个加上去直到大于divide...
分类:其他好文   时间:2014-06-11 12:17:22    阅读次数:274
黑马程序员-张老师基础5-泛型
泛型:泛型只是提供给编译器。在编译完之后,生产字节码文件时就擦除类型信息,泛型就不在了泛型的术语:整个Arraylist:称为泛型类型。Arraylist中的E称为类型变量或类型参数整个Arraylisst称为:参数化的类型Arraylist中的Integer称为类型参数的实例。Arraylist中...
分类:其他好文   时间:2014-06-11 08:03:03    阅读次数:265
[LeetCode] String to Integer (atoi) [7]
这是个老题目了,主要考察的是能不能考虑到所有的情况,还有就是怎么判断是否溢出。 情况大致分为如下四种:(下面我使用@代替空格,x代表除数字之外的所有字符) 1. "@@[+-]3232343@@" 2. "@@[+-]333x54" 3. "@@[+-]4343" 4. "2147483648"或者"-2147483649"(也就是溢出的情况) 下面代码中给出了两个判断是否溢出的方法。...
分类:其他好文   时间:2014-06-08 15:47:49    阅读次数:270
[LeetCode] Palindrome Number [13]
题目: Determine whether an integer is a palindrome. Do this without extra space. 解题思路: 判断一个int型整数是不是回文数字,这个题也不难,依次取得数字最高位和最低位进行比较,就可以判断是不是回文数字。需要注意的是负数不是回文数字。 代码实现:...
分类:其他好文   时间:2014-06-08 15:35:48    阅读次数:375
[LeetCode] Reverse Integer [8]
题目 Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321。 解题思路: 颠倒一个整数中数字的位置,哈哈,类似翻转字符串一样,只不过整数需要计算,需要考虑溢出,其他无而。写出代码不难,只是溢出的时候怎么办,我这里是按照返回-1处理的,在leetcode上可以AC。 代码实现:...
分类:其他好文   时间:2014-06-08 14:47:58    阅读次数:257
显示进度条
static void jindutiao_ZF(Args _args){ RunBaseProgress progress; integer i,j;; i = 10000; progress = new...
分类:其他好文   时间:2014-06-08 07:24:32    阅读次数:189
Java 自动装箱和拆箱
JDK1.5之后的功能自动装箱:指的是开发人员可以把一个基本数据类型直接赋给对应的包装类自动拆箱:指开发人员可以把一个包装类对象直接赋给对应的基本数据类型public static void main(String[] args) { Integer i = 1; //装箱 int j...
分类:编程语言   时间:2014-06-07 23:38:09    阅读次数:350
[Leetcode] Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another ex...
分类:其他好文   时间:2014-06-07 20:34:41    阅读次数:214
leetcode——String to Integer (atoi) 字符串转换为整型数(AC)
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...
分类:其他好文   时间:2014-06-07 12:21:30    阅读次数:284
leetcode——Reverse Integer 反转整数数字(AC)
这个题比较简单,考虑特殊情况如12000,注意检查反转后数字是否会越界溢出。...
分类:其他好文   时间:2014-06-07 12:01:08    阅读次数:258
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!