← Salesforce questions
CodingReported in a candidate post, Nov 2025

Implement a max stack

Filed under Salesforce

Design a max stack supporting push(x), pop(), top() and get_max() (the maximum element in the stack), all in O(1) time. Follow-up: implement a maximum frequency stack.

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

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