Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:
其他好文 时间:
2014-10-19 22:35:19
阅读次数:
165
Choose the best routeTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7361Accepted Submission(s): 2...
分类:
其他好文 时间:
2014-10-19 15:30:34
阅读次数:
279
1. du和df的区别?du统计文件的大小,需要遍历整个目录;df统计磁盘的使用情况; du -s /dir du -ab /dir ; df -h /disk1正常情况下两者数值接近,但如果存在打开文件的进程,而该文件被rm或者mv出去,则统计该目录du空闲空间大于df的空间空间;因为df记录磁....
分类:
Web程序 时间:
2014-10-19 10:15:04
阅读次数:
737
知道是求连续最大子数组后就简单了。但是注意边界条件,如果最大子数组之和<0,那就不要交易了, 返回0.
public class Solution {
public int maxProfit(int[] prices) {
if(prices.length < 2)
return 0;
int n = prices....
分类:
其他好文 时间:
2014-10-19 00:06:49
阅读次数:
146
明白了上一题是求最大的连续子数组之和后,这题就更加简单了,遇到小于0的就不要加。
public class Solution {
public int maxProfit(int[] prices) {
if(prices.length < 2)
return 0;
int n = prices.length;
...
分类:
其他好文 时间:
2014-10-19 00:05:52
阅读次数:
194
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-10-18 22:14:23
阅读次数:
151
1 //Accepted 176 KB 16 ms 2 //一头牛,如果rank是能确定的,那么能打败他的牛的个数和被他打败的牛的个数的总和为n-1 3 #include 4 #include 5 #include 6 #include 7 #include 8 #inclu...
分类:
其他好文 时间:
2014-10-17 23:09:18
阅读次数:
290
最近精力比较有限,有些常用的东西就先记录下来。方便以后自己查阅和总结。
一个哥们想要实现如下效果:
DEPTNO ENAME SAL TOP3 部门工资 排序
---------- ---------- ---------- ----------
20 KING 5...
分类:
数据库 时间:
2014-10-17 15:40:06
阅读次数:
181
题目描述: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 transactio...
分类:
其他好文 时间:
2014-10-17 02:09:43
阅读次数:
293