Amazon SDE-2 Interview Questions - 2

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2025-07-15Added By Anonymous
Source: Link

Company: Amazon
Role: SDE-2
Interview Stage: Onsite
Location: unknown
Year: unknown

Original Post Content:

Programming Question Asked

- Implement Max-Stack/Min-Stack (https://leetcode.com/problems/max-stack/)
- For those who do not have premium, the question is like follows.

Design a max stack data structure that supports the stack operations and supports finding the stack's maximum element.

Implement the MaxStack class:
- MaxStack() Initializes the stack object.
- void push(int x) Pushes element x onto the stack.
- int pop() Removes the element on top of the stack and returns it.
- int top() Gets the element on the top of the stack without removing it.
- int peekMax() Retrieves the maximum element in the stack without removing it.
- You must come up with a solution that supports O(1) for each top call and O(logn) for each other call.

---

LP Questions Asked:

- Tell me about a time when you learned new technologies.
- Tell me about a situation where you had a conflict with someone on your team.

Comments