原题:
Say you have an array for which the ith element is the price of a given stock on day i.
If you were only permitted to complete at most one transaction (ie, buy one and sell one share of th...
分类:
其他好文 时间:
2014-05-13 14:12:41
阅读次数:
342
Person's solution 是用来一种基于软件的解决关键区域问题的算法(critical-section).
它并非完美的,有可能不正确地工作。而且是限制解决两个进程同步的问题。
但是它很简单,很原始,学习起来也是很轻松的。
代码如下:
do {
flag[i] = true;
turn = j;
while (flag[j] && turn == j...
分类:
编程语言 时间:
2014-05-13 08:01:01
阅读次数:
407
Best Time to Buy and Sell StockSay you have an
array for which theithelement is the price of a given stock on dayi.If you were
only permitted to compl...
分类:
其他好文 时间:
2014-05-12 05:56:14
阅读次数:
315
Given two wordsword1andword2, find the minimum
number of steps required to convertword1toword2. (each operation is counted as 1
step.)You have the fol...
分类:
其他好文 时间:
2014-05-10 01:09:28
阅读次数:
325
Given two words word1 and word2, find the
minimum number of steps required to convert word1 to word2. (each operation is
counted as 1 step.)You have t...
分类:
其他好文 时间:
2014-05-09 19:09:35
阅读次数:
318
1.NSOperation对于NSOperation,In OS X v10.6 and later,
operation queues ignore the value returned by this method and always start
operations on a separat...
分类:
移动开发 时间:
2014-05-09 17:36:56
阅读次数:
494
Say you have an array for which theithelement
is the price of a given stock on dayi.If you were only permitted to complete at
most one transaction (ie...
分类:
其他好文 时间:
2014-05-09 13:13:02
阅读次数:
283
使用asp.net导出Excel有多重方法。经过总结,现推荐一种简易方法,不用再记那些复杂的类名了。code:using
System.Data;using System.IO;//add Microsoft.Excel refference and set operation
right in s...
分类:
Web程序 时间:
2014-05-08 18:16:51
阅读次数:
276
调用EditorPart的doSaveAs比较容易,调用doSave方法稍微复杂一些,因为需要传入IProgressMonitor参数,如下声明
@Override
public void doSave(IProgressMonitor monitor) {
// Do the Save operation
}
@Override
public void doSaveAs() {
...
分类:
其他好文 时间:
2014-05-07 15:08:58
阅读次数:
348
在安装好的XenServer中安装VM时出现了"HVMisrequiredforthisoperation"的报错,原来原因只是我的小HP台式机没有开启虚拟化支持功能,立马在XenServer主机的BIOS开启了双V即能正常创建。
分类:
其他好文 时间:
2014-05-06 17:09:10
阅读次数:
317