Implement a Queue using Stacks

Akiko Green
Nerd For Tech
Published in
4 min readFeb 15, 2023

--

A stacked sandwhich from Unsplash by Louis Hansel

I recently deep dived my way to learning implementations of Stacks & Queues. There I learned how to create my own stack & queue classes, while implementing them with arrays and linked list.

Now, I didn’t want to just “learn” what a Stack or Queue was, I wanted to really test myself to see if I understood how to solve an algorithm regarding these implementations. What better way to test my knowledge than with good old Leetcode. Before I show you how I solved this problem, please try your hand in solving it, if you have not already!

How To Implement A Queue With 2 Stacks

--

--

Akiko Green
Nerd For Tech

Software Engineer, Novice Blogger, Indoor Climbing Cutie 🥰