Python, Java and C++ each ship a fast queue — you'll almost never write one from scratch in an interview. JavaScript is the exception. Here's what to use in each language, what the methods are called, and the traps that cost people marks.
The same small job in all four: put some numbers in a queue, then take them all out. They come out in the order they went in.
Members only · free account
The rest of this lesson, with 3 more sections, 1 drawing, a dry-run simulator and code in JavaScript, Python, Java and C++, opens with a free account.
Not ready yet? The is free to read, no account needed.
In the rest of this lesson