题目:
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete at most two transactions.
Note:
...
分类:
编程语言 时间:
2015-07-26 15:53:12
阅读次数:
155
描述 求A+B是否与C相等。输入T组测试数据。每组数据中有三个实数A,B,C(-10000.0 2 3 using namespace std; 4 5 int main() 6 { int n; 7 double a,b,c; 8 cin>>n; 9 whil...
分类:
其他好文 时间:
2015-07-24 09:08:35
阅读次数:
95
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1028思路分析:该问题要求求出某个整数能够被划分为多少个整数之和(如 4 = 2 + 2, 4 = 2 + 1 + 1),且划分的序列 2, 2 或者 2, 1, 1为单调非递增序列;使用动态规划解法:假...
分类:
其他好文 时间:
2015-07-22 20:12:42
阅读次数:
62
mybatis 的动态sql语句是基于OGNL表达式的。 分以下几类: 1. if 语句 (简单的条件判断) <if?test="itemOid?!=?null">
????item_oid?=?#{itemOid}
</if>?//item_oid?为表的列名,itemOid为传入参数的属...
分类:
数据库 时间:
2015-07-22 14:54:34
阅读次数:
259
Given an array of integers, find out whether there are two distinct indicesiandjin the array such that the difference betweennums[i]andnums[j]is at mo...
分类:
编程语言 时间:
2015-07-22 01:37:07
阅读次数:
153
1. 智能指针(Smart Pointer)i.是存储指向动态分配(堆)对象指针的类ii.在面对异常的时候格外有用,因为他们能够确保正确的销毁动态分配的对象iii.RAII类模拟智能指针,见备注2. C++11提供了以下几种智能指针,位于头文件,它们都是模板类i.std::auto_ptr(复制/赋...
分类:
编程语言 时间:
2015-07-21 22:07:28
阅读次数:
212
题目描述
链接地址
解法
算法解释题目描述Given 2*n + 2 numbers, every numbers occurs twice except two, find them.ExampleGiven [1,2,2,3,4,4,5,3] return 1 and 5ChallengeO(n) time, O(1) extra space.
.链接地址http://www.lintcode...
分类:
其他好文 时间:
2015-07-20 23:32:36
阅读次数:
137
【012-Integer to Roman(数字转罗马字符)】输入一个数字,将它转成一个罗马数字,输入的数字在[1, 3999]之间。
罗马数字的表示:
个位数举例: (I, 1) (II, 2) (III, 3) (IV, 4) (V, 5) (VI, 6) (VII, 7) (VIII, 8) (IX, 9)
十位数举例:(X, 10) (XI, 11) (XII, 12) (X...
分类:
编程语言 时间:
2015-07-20 09:21:27
阅读次数:
135
上一篇,我们制定了一个很简单的RPC消息 的格式,但是还遗留了两个问题
我们并没有实现相应的encode和decode方法,没有基于可以跨设备的字符串传输,而是直接的内存变量传递。现在的RPC request不支持带参数的请求命令。如add(a, b), 如何在RPC消息中描述参数a,b 。
我先来实现第二个问题,即带参数的RPC调用。
其实,也没什么太大不同。既然是要带参数,那...
分类:
其他好文 时间:
2015-07-19 08:54:24
阅读次数:
155
1.??????????? 关键数据结构 i.??????????? FreePageRun 描述将要用来分配的地址空间(逻辑地址空间,下同)。 ii.??????????? Run 相同大小的slot的集合。 iii.???????...
分类:
其他好文 时间:
2015-07-17 23:11:47
阅读次数:
350