← Walmart questions

Maximize stock profit with O(1) space

Filed under Walmart

You are given an array of prices where prices[i] is the price of a given stock on the i-th day. Maximize your profit by choosing a single day to buy one stock and choosing a different day in the…

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 Walmart questions

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