Best time to buy and sell stock ii leetcode c++
LeetCode OJ (C#) – Best Time to Buy and Sell Stock II | miafish
Say you have an array for which the i th element is the price of a given stock on day i. Design an algorithm to find the maximum profit.
You may complete as many transactions as you like ie, buy one and sell one share of the stock multiple times. However, you may not engage in multiple transactions at the same time ie, you must sell the stock before you buy again.
Subscribe to see which companies asked this question. Frequently Asked Questions Terms of Service.
Best Time to Buy and Sell Stock II. Discuss Editorial Solution Pick One.
Seen this question in a real interview before? When did you encounter this question? E Best Time to Buy and Sell Stock H Best Time to Buy and Sell Stock III H Best Time to Buy and Sell Stock IV M Best Time to Buy and Sell Stock with Cooldown.