Find the minimum value in the stack in O(1) both time and space complexity.
Ask HN: What are the best interview questions you've been asked?
11–20 of 63 posts
Re: Ask HN: What are the best interview questions you've been asked?
#12one i really enjoyed solving: given an array of size (n - 1), containing all but one of the numbers between 1 and n, find the missing number in linear time and constant space.
"What's the best you can do within ..." adds an extra challenge - in particular I don't think I'd often see the constant space solution as perhaps one in logspace.
Re: Ask HN: What are the best interview questions you've been asked?
#13Find the minimum value in the stack in O(1) both time and space complexity.
Is that it?
Re: Ask HN: What are the best interview questions you've been asked?
#14Find the minimum value in the stack in O(1) both time and space complexity.
Make another stack with the latest minimum, then when you pop that top value, you also pop it off the minimums stack. Then you have the last minimum before that one. Is that it?
Re: Ask HN: What are the best interview questions you've been asked?
#15Re: Ask HN: What are the best interview questions you've been asked?
#16Find the minimum value in the stack in O(1) both time and space complexity.
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.
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...
Re: Ask HN: What are the best interview questions you've been asked?
#17Find the minimum value in the stack in O(1) both time and space complexity.
Make another stack with the latest minimum, then when you pop that top value, you also pop it off the minimums stack. Then you have the last minimum before that one. Is that it?
Re: Ask HN: What are the best interview questions you've been asked?
#18What has been your biggest screw up to cause a production outage and what did you take from that?
If they say they never caused an outage or give some answer that isn't a screw up, I know one of two things
1) They arent senior level to be put in charge of handling major changes on production
2) They are the type of person that tries to hide screw ups from the rest of the team.
Re: Ask HN: What are the best interview questions you've been asked?
#19"We're going to build Google Maps using these satellite images. How would you do it?" This is the sort of open, large architectural question that I love and think really helps to understand a developer's skill set. It's great to be able to start very broad, but focus down into detail like CPU caching and the possible on-disk layout.
Re: Ask HN: What are the best interview questions you've been asked?
#20For a sys admin, devops, sre or whatever you want to call us this week, I like the following question for senior level people What has been your biggest screw up to cause a production outage and what did you take from that? If they say they never caused an outage or give some answer that isn't a screw up, I know one of two things 1) They arent senior level to be put in charge of handling major changes on production 2…