HackerRank - Queue Using Two Stacks | Full Solution with Examples and Visuals | Study Algorithms

Опубликовано: 29 Сентябрь 2024
на канале: Nikhil Lohia
12,483
311

You are required to replicate the operations of a queue, using only the provided two stack data structures. The implemented could should support functions like enqueue, dequeue, head, and isEmpty. Watch this video to see a live demo of how this solution can be implemented. You don't have different ways to implement this but you can come up with a solution with intuition. Watch the video to understand the problem in a simplified manner. I then work along with you to solve it in an efficient manner. All along with visuals and explanations.

00:00 - Intro
01:42 - Problem Statement and Test Cases
03:55 - Demo of the solution
11:56 - Dry-run of code
15:35 - Final thoughts

📚 Links I talk about in the video:
Queue Data Structure:    • Queue Data Structure explained with a...  
Stack Data Structure:    • Stack Data Structure explained with a...  

Actual problem on HackerRank:
https://www.hackerrank.com/challenges...

Code on Github:
https://github.com/nikoo28/java-solut...

Test cases on GitHub:
https://github.com/nikoo28/java-solut...

📘 A text based explanation is available at:
https://studyalgorithms.com/array/que...

🔗 To see more videos like this, you can show your support on: https://www.buymeacoffee.com/studyalg...

💻 Get Social 💻
Follow on Facebook at:   / studyalgos  
Follow on Twitter at:   / studyalgorithms  
Follow on Tumblr at:   / studyalgos  
Subscribe to RSS feeds: https://studyalgorithms.com/feed/
Join fan mail: http://eepurl.com/g9Dadv

#hackerrank #programming #interview