Panda Guru LogoPanda
Guru

LinkedIn Screening Round

Screening Round

Questions: Implement a max stack class, that would allow you to do normal stack operation along with max operation such as peek and pop. Expectation: All operation except popMax(), should be around O(n) complexity.

class MaxStack: def __init(self): pass def push(int v): pass def pop(): pass def peek(): pass def popMax(): pass def peekMax(): pass
Candidate's Approach
  • Suggested a combination of linked-list/stack with stack/max-heap respectively.
  • The interviewer finalized on the stack + max heap approach.
  • Completed the code within the time limit; the interviewer asked to make the code production ready.
Interviewer's Feedback

No feedback provided.