【题目】
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 row is greater than the last integer of the previous ...
分类:
其他好文 时间:
2014-06-05 08:28:43
阅读次数:
321
自然对齐:
1.一个基本类型实例的大小要能整除其地址值。
2.数组有着和数组里类型本身相同的对齐要求。
3.一个聚集类型的实例,其对齐要求最严格的子类型的排列要能整除聚集的地址
在32位机器上,
char的大小为1(以字节计),所以它可以被存储在内存的任意地址处
short的大小为2,所以它只能存储在“偶数”地址处
integer和指针的大小为4(32位机上一个字为4个字节),所以它们只能存储在一个字界中
double的大小为8,所以它只能存储在两个字界中...
分类:
其他好文 时间:
2014-06-05 03:52:15
阅读次数:
200
问题
输入:一个表示数字的字符串,需要考虑不同的输入形式。
输出:对应的整数
特殊输入形式:
1.输入开始几个字符为空格
2.考虑正负号
3.数字字符不属于[0,9]时,输出当前结果
4.字符串代表的数字大于INT_MAX或者小于INT_MIN时输出INT_MAX或者INT_MIN。
class Solution {
// out of range...
分类:
其他好文 时间:
2014-06-03 06:30:14
阅读次数:
314
1 如何将字串 String 转换成整数 int?
A. 有两个方法:
1). int i = Integer.parseInt([String]); 或
i = Integer.parseInt([String],[int radix]);
2). int i = Integer.valueOf(my_str).intValue();
注: 字串转成 Double, Float, Lo...
分类:
编程语言 时间:
2014-06-03 04:43:07
阅读次数:
297
Find The MultipleTime Limit: 1000MSMemory
Limit: 10000KTotal Submissions: 16995Accepted: 6921Special JudgeDescriptionGiven
a positive integer n, write...
分类:
其他好文 时间:
2014-06-01 11:27:41
阅读次数:
176
【题目】
Given two sorted integer arrays A and B, merge B into A as one sorted array.
Note:
You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements from B. The number of elements initialized in A and B are...
分类:
其他好文 时间:
2014-06-01 09:21:16
阅读次数:
292
【题目】
The gray code is a binary numeral system where two successive values differ in only one bit.
Given a non-negative integer n representing the total number of bits in the code, print the sequence of gray code. A gray code sequence must begin with 0.
...
分类:
其他好文 时间:
2014-06-01 09:16:29
阅读次数:
242
Description
T. Chur teaches various groups of students at university U. Every U-student has a unique Student Identification Number (SIN). A SIN s is an integer in the range 0 ≤ s ≤ MaxSIN with MaxS...
分类:
其他好文 时间:
2014-06-01 07:40:18
阅读次数:
248
1.Integer转换成int的方法Integer i; int k =
i.intValue();即Integer.intValue();2.int转换成Integerint i;Integer it = new
Integer(i);3.String转换成int的方法String str = "...
分类:
编程语言 时间:
2014-05-31 08:27:30
阅读次数:
260
Given an integer, convert it to a roman
numeral.Input is guaranteed to be within the range from 1 to 3999.相对应的一道题:Roman
to Interger :http://www.cnblog...
分类:
其他好文 时间:
2014-05-31 02:37:44
阅读次数:
221