amazon logo
Amazon· SDE-2

Amazon SDE-2 Interview Questions - 2

Posted
15 Jul 2025
269 reads

Summary

I was asked a programming question about designing a Max Stack data structure with specific time complexity constraints, along with several Amazon Leadership Principle (LP) questions.

How it went

Programming Question Asked

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.

Questions asked (3)

  1. 01

    Max Stack Design

    Data Structures & Algorithms

    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.
    Open the problem
  2. 02

    Learning New Technologies (Behavioral)

    Behavioral

    Tell me about a time when you learned new technologies.

  3. 03

    Conflict with a Team Member (Behavioral)

    Behavioral

    Tell me about a situation where you had a conflict with someone on your team.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Amazon recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!