LinkedIn Screening Round
Anonymous User
2066

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():
		pass

My approach:

  • I suggested a combination of linked-list/stack with stack/max-heap respectively
  • The discussion I had with the interviewer, he finalised on the stack + max heap approach
  • I completed the code within the timelimit, the interviewer asked me to make the code production ready

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?

Comments (5)