Tuesday common C++ interview problem: Best time to buy and sell stock.
Given information about stock prices as std::vector<int> (each element represents the price at that time), determine the maximum possible profit with two transactions.
You can only hold one stock at a time and only do one buy or sell operation at each time.
Solve it yourself: https://compiler-explorer.com/z/ejn937hqa
Solution: https://compiler-explorer.com/z/f3sT7ad4G