摘要:
一开始没理解对题意,估计是理解成III那道题的样子了。理解对了以后发现挺简单的。但看了参考之后发现它的解法更简洁优美,就直接照着来了。public class Solution { public int maxProfit(int[] prices) { // Start typ... 阅读全文
posted @ 2013-08-05 13:51
阿牧遥
阅读(188)
评论(0)
推荐(0)
摘要:
一趟遍历。O(n)。期间记录最小的价格min的值并不断比较更新最大差价。public class Solution { public int maxProfit(int[] prices) { // Start typing your Java solution below ... 阅读全文
posted @ 2013-08-05 12:20
阿牧遥
阅读(191)
评论(0)
推荐(0)

浙公网安备 33010602011771号