Jon Skeet: Creating a Queue from Scratch
This is another very popular question from larger companies, and requires you to be familiar with linked lists, arrays and stacks.
This question is a bit simpler - but if you're a C# person it might be a bit from left field as .NET folks typically don't think about stacks and queues very much. It's a good thing to know as they're used in interviews quite often.
This question is a bit vague as I decided to โevolveโ it as Jon coded. I started with:
Assume there are no other list types in .NET other than a Stack and a Linked List. Create a Queue
Which evolved to โฆ
Create a Queue from two stacks.
If you want to follow along in JavaScript feel free. An Array can be used as a stack with push and pop.
Updated on Nov 14, 2025