Maximum stock trading profit with at most two buy-and-sell transactions
Company: Oracle
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Other
Overview: A stock trading optimization problem: given daily prices, find the maximum profit using at most two buy-then-sell transactions while holding at most one share at a time. It tests reasoning about splitting the price history into non-overlapping trades and handling falling, flat or steadily rising prices.
Read the full Oracle Software Engineer interview experience this question came from