← Goldman Sachs questions

Stock Buy and Sell - Max One and Two Transactions

Filed under Goldman Sachs

Given an array of prices where prices[i] is the price of a given stock on the i-th day, find the maximum profit you can achieve. You may complete at most one transaction (buy once and sell once) and…

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Goldman Sachs questions

Collected from public candidate posts and coding forums. Updated Nov 2026.