Search
⌘K
Leetcode 123. Best Time to Buy and Sell Stock III
Given daily stock prices, find the maximum profit achievable with at most two non-overlapping buy-sell transactions (you must sell before buying again). Expect to exploit the two-transaction structure (e.g., split the timeline or use DP on transaction states) and aim for an O(n) solution since n can be up to 1e5.
Asked at:
Meta
Oracle
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Mid February, 2026
Meta
Mid-level
Early February, 2026
Oracle
Senior
Hello Interview Premium
Your account is free and you can post anonymously if you choose.