Hello Everyone,
In this video, we have discussed the problem generally asked in the JavaScript Coding/ Machine Coding round at the Frontend interview.
Problem Statement: Implement Stack Using Queue
Suppose you have a stack, which has only follow interface:
class Queue {
enqueue(element) { /* add element to queue, similar to Array.prototype.push */ }
peek() { /* get the head element*/ }
dequeue() { /* remove the head element, similar to Array.prototype.shift */ }
size() { /* count of elements */ }
}
Could you implement a Queue by using only the above Stack? A Queue must have the following interface
class Stack {
push(element) { /* add element to stack */ }
peek() { /* get the top element */ }
pop() { /* remove the top element */}
size() { /* count of elements */}
}
We have discussed the following problem areas:
1. Problem Statement
2. Approach the Solution
3. Solution Implement
Let's Connect:
Github: https://github.com/mkdudeja
Topmate: https://topmate.io/mkdudeja
Twitter: / mkdudeja
LinkedIn: / mkdudeja
Facebook: / mkdudeja
Instagram: / mkdudeja
Thanks,
Manish K. Dudeja
#javascript #reactjs #frontendinterview #interviewquestion
Nesta página do site você pode assistir ao vídeo on-line Implement Stack Using Queue | JavaScript Machine Coding | Frontend Interview duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Manish K. Dudeja 24 Janeiro 2024, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 85 vezes e gostou 1 espectadores. Boa visualização!