← Amazon questions

Design O(1) max stack and stock buy-sell profit

Filed under Amazon

Design a Stack class that supports push, pop, and findMax in O(1) time. Also, given an array of stock prices, find the maximum profit from one buy and one sell transaction.

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

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