I appeared for Linkedin phone screening round.
Team: Platform and Infra team
Question asked: 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():
pass
def push(int v):
pass
def pop():
pass
def peek():
pass
def popMax():
pass
def peekMax():
passMy approach:
Outcome: I thought the interview went well. But the recuriter told me that I was rejected.
The code was supposed to be done on a coderpad link. But linkedin does not allow you to run the code. While my approach was right, the code was working (verified post the interview). But for some reason I got rejected. Any idea what happened?