Search
⌘K

Leetcode 122. Best Time to Buy and Sell Stock II

Given daily stock prices, compute the maximum profit you can achieve with unlimited buy/sell operations while holding at most one share at a time (you may buy and sell on the same day). The optimal strategy is to capture every upward price movement, i.e., sum all positive consecutive day-to-day gains.

Asked at:

Oracle

Meta


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Mid March, 2026

Meta

Senior

Late January, 2026

Oracle

Senior

Your account is free and you can post anonymously if you choose.