题目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 (...
转载 2015-04-03 19:26:00
49阅读
2评论
121. Best Time to Buy and Sell Stock Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitte
转载 2019-01-05 22:35:00
112阅读
2评论
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, buy one and sell one share of the stock), design an algorithm to find the maximum profit.最简单的方法就是穷举,O(n2)。 1 public class Solution { 2 public in...
转载 2013-09-11 05:16:00
24阅读
2评论
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-08-31 11:58:00
108阅读
2评论
Question : 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
转载 2013-04-21 21:12:00
104阅读
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...
转载 2015-03-25 14:42:00
79阅读
2评论
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 comple
转载 2017-08-13 11:42:00
101阅读
2评论
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
转载 2017-05-24 19:53:00
107阅读
2评论
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-11-29 11:55:00
76阅读
2评论
** * https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock/ * Say you have an array for which the ith element is the price of a given stock
转载 2017-04-28 08:49:00
328阅读
2评论
题目: 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 the stock),
原创 2022-08-01 12:22:08
151阅读
Best Time to Buy and Sell Stock IISay you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the ...
原创 2021-08-07 11:42:39
104阅读
Question 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 c
原创 2023-02-02 14:56:03
116阅读
题目: 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 transac
原创 2021-08-06 16:01:55
96阅读
Best Time to Buy and Sell Stock 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
转载 2018-01-24 08:36:00
130阅读
2评论
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-07-03 11:23:00
46阅读
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, buy one and sell one share of the stock), design an algorithm to find the maximum profit.code : 朴素的算法,对每一个i ,计算 最大 的 prices[j] (j>i) 来维护最大的差值,但是这
转载 2013-10-09 19:44:00
59阅读
2评论
题目 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 com
转载 2016-01-28 12:53:00
108阅读
2评论
题目 https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/ Say you have an array for which the ith element is the price of a given stock on
转载 2017-07-13 13:05:00
80阅读
2评论
明确了上一题是求最大的连续子数组之和后。这题就更加简单了,遇到小于0的就不要加。 public class Solution { public int maxProfit(int[] prices) { if(prices.length < 2) return 0; int n = prices.l
转载 2017-05-25 08:12:00
72阅读
2评论
  • 1
  • 2
  • 3
  • 4
  • 5