Thanks. I misunderstood "at most one transaction" to be "buy one or sell one share"
(the actually meaning is "buy one and sell one share").
We must buy it before sell it. And not buy and sell is also a solution, which get 0 profit.
Er, well why don't you buy again on day 5 for price 0 and sell on day 6 to get a total profit of 7?
Because you only have one transaction total in this problem. One transaction at a time is part of ii and iii.
Oh, at first I read it the way the first commenter did, and then I thought it was a "one per day" limit. Thanks
please add this testcase with explanations on the problem statement, the problem is really unclear
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.