121. Best Time to Buy and Sell Stock
source code
1 | // Runtime: 80 ms, faster than 33.60% of JavaScript online submissions for Best Time to Buy and Sell Stock. |
test cases:
1 | test("test1", () => { |
122. Best Time to Buy and Sell Stock II
这道题的思路是:因为能买卖无数次,只要能赚钱(价格比前一天高),就尽快卖出。能同一天进行买卖。
source code
1 | // Runtime: 84 ms, faster than 27.73% of JavaScript online submissions for Best Time to Buy and Sell Stock II. |
test cases
1 | test("test1", () => { |
123. Best Time to Buy and Sell Stock III
source code
1 | // Runtime: 2064 ms, faster than 5.19% of JavaScript online submissions for Best Time to Buy and Sell Stock III. |
test code
1 | test("test1", () => { |