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...
分类:
其他好文 时间:
2014-06-25 23:01:44
阅读次数:
227
Divide two integers without using multiplication, division and mod operator.
思路:1.先将被除数和除数转化为long的非负数,注意一定要为long,因为Integer.MIN_VALUE的绝对值超出了Integer的范围。
2.常理:任何正整数num都可以表示为num=2^a+2^b+2^c+.....
分类:
其他好文 时间:
2014-06-25 19:46:17
阅读次数:
246
特定容器算法
lst.merge(lst2)
将来自lst2的元素并入到lst。这两个都必须是有序的。
lst.merge(lst2, comp)
元素将从lst2删除,第一个版本使用
lst.remove(lst2)调用erase删除掉与给定值相等(==)或令一元谓词为真的每个元素
lst.remove_if(pred)
lst.reverse() 反转...
分类:
编程语言 时间:
2014-06-25 19:32:39
阅读次数:
200
简析SynchronousQueue,LinkedBlockingQueue,ArrayBlockingQueue
三者都是blockingQueue.
LinkedBlockingQueue,ArrayBlockingQueue
有界,默认是Integer.Max;
SynchronousQueue没什么界不界的概念.之所以这么...
分类:
其他好文 时间:
2014-06-25 19:19:39
阅读次数:
397
【问题】
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Valid operators are +, -, *, /.
Each operand may be an integer or another expression.
Some examples:
...
分类:
编程语言 时间:
2014-06-24 23:22:53
阅读次数:
331
题目
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return...
分类:
其他好文 时间:
2014-06-24 21:46:24
阅读次数:
249
【问题】
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
【代码】
class Solution:
# @param s, a string
# @retu...
分类:
其他好文 时间:
2014-06-24 21:00:30
阅读次数:
168
题目
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
Have you thought about this?
Here are some good questions to ask before coding. Bonus poin...
分类:
其他好文 时间:
2014-06-24 20:16:39
阅读次数:
180
一.建立数据库sqlite3.exe test.db二.双击sqlite-3_6_16目录下的程序sqlite3.exe,即可运行三.退出.exit或者.quit四.SQLite支持如下5种数据类型1.NULL:空值。2.INTEGER:带符号的整型,具体取决有存入数字的范围大小。3.REAL:浮点...
分类:
数据库 时间:
2014-06-24 14:20:01
阅读次数:
262
题目:Reverse IntegerReverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you thought about...
分类:
其他好文 时间:
2014-06-24 14:12:18
阅读次数:
184