Re:Ask HN: What are the best interview questions you've been...
by glandium on Tuesday February 21, 2017 @08:40PM
(#13702132)
Do you mean "design a stack where you can find the minimum value in O(1) both time and space complexity"? Because I don't see how you can do O(1) with an arbitrary stack.
[ Parent
| on HN ]
Re:Ask HN: What are the best interview questions you've been...
by antoaravinth on Tuesday February 21, 2017 @10:44PM
(#13702825)
Yes thats right, you can come up with any solution. But make sure O(1) is satisfied (both in time and space complexity).
Anyways I had failed to give proper answer and I was rejected in the interview. This was the last question of my last round!
Spoiler: Here is one such solution using a simple but very clever trick: http://www.geeksforgeeks.org/design-a-stack-that-supports-ge...