Amazon Coding Interview Question - Min Stack (LeetCode)

Publicado em: 01 January 1970
no canal de: AlgosWithMichael
8,296
201

Here is a step by step explanation of a stack based problem asked at many top tech companies!

Check out my interview prep platform for learning the patterns!
📢 Interview Prep Platform: https://algoswithmichael.com

🎧 Join the community Discord:   / discord  
💰 Support me on Patreon:   / michaelmuinos  
🔗Follow me on LinkedIn:   / michael-muinos  
📂Follow me on Github: https://github.com/MichaelMuinos

The problem "Min Stack" has been a popular interview question for a long time now asked at top tech companies including Amazon, Google, Bloomberg, and Apple. For this problem, we must extend the functionality of a stack (LIFO) and allow for constant time lookup for the minimum element in our stack.

A common pitfall for this problem is to keep track of the minimum element with a single variable; however, that will not work in the scenario we pop our minimum element. What we must do is create a second stack that keeps track of our minimum every time we add a new element into our original stack.

The time complexity is constant time O(1) and our space complexity is O(N) where N is the number of elements in our stacks.


Nesta página do site você pode assistir ao vídeo on-line Amazon Coding Interview Question - Min Stack (LeetCode) duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário AlgosWithMichael 01 January 1970, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 8,296 vezes e gostou 201 espectadores. Boa visualização!