Chapter 12: Stacks and Queues
This chapter covers the most popular interview coding challenges involving stacks and queues. Mainly, you will learn how to provide a stack/queue implementation from scratch and how to tackle coding challenges via Java's built-in implementations, such as the Stack
class, and the Queue
interface implementations, especially ArrayDeque
. Commonly, a coding challenge from this category will ask you to build a stack/queue or will ask you to solve a certain problem using Java's built-in implementations. Depending on the problem, it may explicitly disallow you to call certain built-in methods that will lead you to finding an easy solution.
By the end of this chapter, you'll have a deep insight into stacks and queues, you'll be able to exploit their capabilities, and also recognize and write solutions that depend on stacks and queues.
In this chapter, you'll learn about the following topics:
- Stacks in a nutshell
- Queues...