首先让我们了解几个概念:栈 :由JVM分配区域,用于保存线程执行的动作和数据引用。堆 :由JVM分配的,用于存储对象等数据的区域。常量池constant pool :在堆中分配出来的一块存储区域,用于存储显式 的String,float或者integer.这是一个特殊的共享区域,可以在内存中共享的不...
分类:
其他好文 时间:
2015-06-13 12:46:10
阅读次数:
91
最近开始刷刷的Leetcode题,遇到了一道这么一个简单的题 Reverse Integer ,然而并没有看上去的那么简单, 特殊的坑就如这道题说的 overflow ! 一开始天真的认为就是每个语言自己定义的最大整数,如 ? 在python中 >>...
分类:
其他好文 时间:
2015-06-13 10:03:52
阅读次数:
132
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
Integers in each row are sorted from left to right.The first integer of each...
分类:
其他好文 时间:
2015-06-13 09:56:33
阅读次数:
98
Determine whether an integer is a palindrome. Do this without extra space.Some hints:
Could negative integers be palindromes? (ie, -1)If you are thinking of converting the integer to string, note the...
分类:
其他好文 时间:
2015-06-13 09:48:14
阅读次数:
101
Reverse digits of an integer.Example1: x = 123, return 321
Example2: x = -123, return -321取一个数的最后一位,用x % 10,取一个数的前n-1位(共n位),用x/10,每一次取的时候,都将上一次取的数乘以10,然后再加上末尾的数即可,代码如下:Code(C++)class Solution {
public...
分类:
其他好文 时间:
2015-06-12 23:55:44
阅读次数:
178
DryingTime Limit: 2000msMemory Limit: 65536KBThis problem will be judged onPKU. Original ID:310464-bit integer IO format:%lld Java class name:MainIt i...
分类:
其他好文 时间:
2015-06-12 19:24:44
阅读次数:
103
链接:https://leetcode.com/problems/valid-number/看完此题,我的第一反应就是利用try-catch块来辨认上面是第一次accept,然后忍不住百度了一下想看看其他人的解法,发现能变成double的肯定能转换成integer,所以,把整型块删掉了。利用try-...
分类:
其他好文 时间:
2015-06-12 19:16:17
阅读次数:
115
Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.1~9: {"I", "II", "III", "IV", "V", "VI", "VI...
分类:
其他好文 时间:
2015-06-12 16:45:05
阅读次数:
94
我们常用的延迟代码函数如Sleep,Thread.Sleep函数,
但是它们只允许输入毫秒,如果我们需求更高精度 如
纳秒(ns)/微秒(us)的延迟代码执行的时间 怎么去做呢?
在上图我们可以看见有这样一个传址参数
long duetime = -10 * us;
原参数类型为
LARGE_INTEGER
定义是用long而不是double
表示需要延迟的时间 它是以1...
Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (i...
分类:
其他好文 时间:
2015-06-12 14:37:29
阅读次数:
107