【题目】
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
比起POJ弱爆了一题,从后往前扫描一遍,O(n)时间,只要注意各种极端情况即可,不明白通过率为什么只有13%。
#include
#include
using namespace std;
class Solution {
public:
void reverseWords(string &s) {
char* cstr = new char[s.size()+1];
...
分类:
其他好文 时间:
2014-06-05 03:45:47
阅读次数:
221
原题地址:https://oj.leetcode.com/problems/evaluate-reverse-polish-notation/题意:Evaluate
the value of an arithmetic expression inReverse Polish Notation.Val...
分类:
编程语言 时间:
2014-06-03 11:18:22
阅读次数:
335
原题地址:https://oj.leetcode.com/problems/reverse-words-in-a-string/题意:Given
an input string, reverse the string word by word.For example,Given s = "the s...
分类:
编程语言 时间:
2014-06-03 11:13:36
阅读次数:
258
Delphi(procedure&procedure .... of object
)函数指针与方法指针 .delphiobjectbuttonintegerdelphi中经常见到以下两种定义Type TMouseProc =
procedure (X,Y:integer); TMouseEvent...
分类:
其他好文 时间:
2014-05-31 15:46:53
阅读次数:
199
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
Evaluate the value of an arithmetic expression
inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an
integer or another express...
分类:
其他好文 时间:
2014-05-30 15:22:39
阅读次数:
301