DSA question set · 180 questions
Queue DSA Practice Questions
Explore 180 DSA questions in Queue. Practice with DSAWiser’s code editor and visualizer.
QueueGraphNetwork FlowBreadth-First SearchDequeMonotonic QueueHeapShortest PathGame TheoryBinary SearchLongest Increasing SubsequenceTrieBit ManipulationFenwick TreeOrder StatisticsTreeDynamic Programming
What’s in this set
The Queue collection contains 180 problems: 43 basic, 36 easy, 56 medium, 37 hard, 8 very hard. Choose a question at your current level, or follow the collection’s order below.
Topics in this collection include Queue, Graph, Network Flow, Breadth-First Search, Deque. Each question shows its own topics and difficulty so you can decide where to begin.
Practice with the code visualizer
- Open a question in the editor and read the statement, inputs, and expected output. Predict the result for a small example before writing code.
- Write a solution and run the examples. If a result differs from your prediction, reduce the input until you can follow each step.
- Step through your code in the visualizer. Use a breakpoint to inspect the state at a specific line, then compare it with your reasoning.
Questions in this set
180 totalOpen a question in the editor to read its statement and examples. Sign in to practice.
- Queue FIFO Enqueue and Dequeue SequenceQueueBasic
- Peek / Front ElementQueueBasic
- Queue IsEmpty and Size StateQueueBasic
- Queue Underflow CheckQueue · Graph · Network FlowBasic
- Array-Based Queue Front and Rear PointersQueueBasic
- Queue Overflow Detection (Fixed Capacity)Queue · Graph · Network FlowBasic
- Sum and Average of Queue ElementsQueueBasic
- Count Occurrences of Target in QueueQueueBasic
- Find Minimum and Maximum in QueueQueueBasic
- Split Queue Elements at Odd and Even PositionsQueueBasic
- Check if Two Queues are IdenticalQueueBasic
- Circular Queue Index CalculationQueueBasic
- Copy Queue ContentsQueueBasic
- Reverse a Queue Using an Auxiliary StackQueueBasic
- Queue Rotation by One PositionQueueBasic
- Queue Rotation by K PositionsQueueBasic
- Count Elements Greater Than a ThresholdQueueBasic
- Remove All Occurrences of a Target ValueQueueBasic
- Interleave Two Queues of Equal SizeQueueBasic
- Front and Rear InspectionQueueBasic
- Queue Size After Batch OperationsQueueBasic
- Check if Queue is SortedQueueBasic
- Replace Negative Elements with ZeroQueueBasic
- Reverse the First K Elements of a QueueQueueBasic
- Concatenate Two QueuesQueueBasic
- Count Distinct Elements in QueueQueueBasic
- Double-Ended Queue (Deque) OperationsQueueBasic
- Find 1-Based Index of First OccurrenceQueueBasic
- Circular Queue Full and Empty StatusQueueBasic
- Check if Queue is a PalindromeQueueBasic
- Middle Element(s) of a QueueQueueBasic
- Remove Every Second ElementQueueBasic
- First-Come, First-Served (FCFS) Print QueueQueueBasic
- Separate Even and Odd Elements into Two QueuesQueueBasic
- Count Elements Ahead in QueueQueueBasic
- Reverse the Last K Elements of a QueueQueueBasic
- Frequency of the Front ElementQueueBasic
- Delete Minimum Element from QueueQueueBasic
- Check if Two Queues are Mutual ReversesQueueBasic
- Circular Queue Size from Front and Rear PointersQueueBasic
- Filter Multiples of K from QueueQueueBasic
- Move All Zeros to the Rear of QueueQueueBasic
- Sort Queue Elements in Non-Decreasing OrderQueueBasic
- Queue Using Two Stacks SimulationQueueEasy
- Merge Two Sorted QueuesQueueEasy
- Generate Binary Numbers from 1 to N Using a QueueQueueEasy
- Circular Queue Array StateQueueEasy
- Interleave First Half and Second HalfQueueEasy
- Round-Robin Queue Service SimulationQueueEasy
- Stack Using Two Queues SimulationQueueEasy
- Number of Recent Calls (Ping Counter)QueueEasy
- Time Needed to Buy TicketsQueueEasy
- Number of Students Unable to Eat LunchQueueEasy
- Moving Average from Data StreamQueueEasy
- First Unique Character in a StreamQueueEasy
- Design Circular QueueQueueEasy
- Design Circular DequeQueueEasy
- Implement Queue Using StacksQueueEasy
- Implement Stack Using QueuesQueueEasy
- Binary Tree Level Order TraversalQueue · Breadth-First Search · GraphEasy
- Minimum Depth of Binary Tree via BFSQueue · Breadth-First Search · GraphEasy
- Symmetric Tree Check via QueueQueue · Breadth-First Search · GraphEasy
- Cousins in Binary TreeQueue · Breadth-First Search · GraphEasy
- Average of Levels in Binary TreeQueue · Breadth-First Search · GraphEasy
- Flood Fill via Queue BFSQueue · Breadth-First Search · GraphEasy
- Hot Potato (Josephus Elimination) via QueueQueueEasy
- Shortest Path in Unweighted Grid via BFSQueue · Breadth-First Search · GraphEasy
- Design Hit CounterQueueEasy
- Card Game War SimulationQueueEasy
- Deepest Leaves Sum via BFSQueue · Breadth-First Search · GraphEasy
- Largest Value in Each Tree RowQueue · Breadth-First Search · GraphEasy
- VIP vs Regular Queue ServiceQueueEasy
- First Negative Integer in Every Window of Size KQueueEasy
- Find Bottom-Left Tree Value via BFSQueue · Breadth-First Search · GraphEasy
- Winner of the Circular Elimination GameQueueEasy
- Keys and Rooms (BFS Graph Reachability)Queue · Breadth-First Search · GraphEasy
- Flatten 2D Vector via Queue of QueuesQueueEasy
- BFS Traversal of an Undirected GraphQueue · Breadth-First Search · GraphEasy
- Maximum Level Sum of a Binary TreeQueue · Breadth-First Search · GraphEasy
- Reveal Cards in Increasing OrderQueueMedium
- Dota2 SenateQueueMedium
- Binary Tree Right Side ViewQueue · Breadth-First Search · GraphMedium
- N-ary Tree Level Order TraversalQueue · Breadth-First Search · GraphMedium
- 0-1 Matrix Distance to Nearest ZeroQueueMedium
- Rotting Oranges (Multi-Source BFS)Queue · Breadth-First Search · GraphMedium
- Binary Tree Zigzag Level Order TraversalQueue · Breadth-First Search · GraphMedium
- Sliding Window Minimum of Size KQueue · Deque · Monotonic QueueMedium
- Sliding Window Maximum of Size KQueue · Deque · Monotonic QueueMedium
- Task Scheduler Execution via Cooldown QueueQueueMedium
- Number of Islands via BFSQueue · Breadth-First Search · GraphMedium
- Stack Permutation Check via QueueQueueMedium
- Nearest Exit from Entrance in MazeQueue · Breadth-First Search · GraphMedium
- Design Front-Middle-Back QueueQueueMedium
- Minimum Knight Moves via BFSQueue · Breadth-First Search · GraphMedium
- Open the Lock (State-Space BFS)Queue · Breadth-First Search · GraphMedium
- Jump Game III (Reach Zero via BFS)Queue · Breadth-First Search · GraphMedium
- Minimum Operations to Transform Number via BFSQueue · Breadth-First Search · GraphMedium
- Snakes and Ladders Board Game via BFSQueue · Breadth-First Search · GraphMedium
- Shortest Bridge Between Two Islands via Multi-Source BFSQueue · Breadth-First Search · GraphMedium
- Longest Continuous Subarray With Absolute Diff Within LimitQueueMedium
- Jump Game VI (DP with Monotonic Deque)Queue · Deque · Monotonic QueueMedium
- Course Schedule (Kahn's In-Degree Queue)QueueMedium
- Course Schedule II (Topological Order Generation)QueueMedium
- Shortest Path with Alternating ColorsQueueMedium
- Minimum Height Trees (Leaf-Trimming via Queue)Queue · Breadth-First Search · GraphMedium
- Shortest Path Graph Construction via BFS (Word Ladder Metric)Queue · Breadth-First Search · GraphMedium
- As Far from Land as Possible (Multi-Source BFS)Queue · Breadth-First Search · GraphMedium
- All Nodes Distance K in Binary TreeQueue · Breadth-First Search · GraphMedium
- Bus Routes (BFS on Route Network)Queue · Breadth-First Search · GraphMedium
- Pacific Atlantic Water Flow (Dual Multi-Source BFS)Queue · Graph · Network FlowMedium
- Minimum Jumps to Reach Home with State QueueQueueMedium
- Shortest Path to Get FoodQueue · Breadth-First Search · GraphMedium
- Maximum of Minimum Values for Every Window SizeQueue · Deque · Monotonic QueueMedium
- Alien Dictionary (Kahn's Topological Sort Queue)QueueMedium
- Clone Graph via BFS QueueQueue · Breadth-First Search · GraphMedium
- Surrounded Regions (Boundary Multi-Source BFS)Queue · Breadth-First Search · GraphMedium
- Constrained Subsequence Sum (DP with Monotonic Deque)Queue · Deque · Monotonic QueueMedium
- Sequence Reconstruction (Unique Topological Sort Check)QueueMedium
- Minimum Genetic Mutation via State BFSQueue · Breadth-First Search · GraphMedium
- Parallel Courses (Semester Count via Kahn's BFS)Queue · Breadth-First Search · GraphMedium
- Minimum Flips to Convert Binary Matrix to Zero MatrixQueueMedium
- Word Break Sentence Segmentation via BFS QueueQueue · Breadth-First Search · GraphMedium
- Find All Groups of Farmland via BFSQueue · Breadth-First Search · GraphMedium
- Smallest String With Swaps (Connected Components via BFS Queue)Queue · Breadth-First Search · GraphMedium
- Sliding Puzzle (2x3 Permutation BFS)Queue · Breadth-First Search · GraphMedium
- Swim in Rising Water (Min-Max Priority Queue BFS)Queue · Heap · Shortest Path · GraphMedium
- Parallel Courses III (Critical Path via Kahn's In-Degree Queue)QueueMedium
- Cheapest Flights Within K Stops (Level-Constrained BFS Queue)Queue · Breadth-First Search · GraphMedium
- Maximum Subarray Sum with Length in [L, R] (Monotonic Deque)Queue · Deque · Monotonic QueueMedium
- Shortest Path in Grid with Teleporters (0-1 BFS)Queue · Breadth-First Search · GraphMedium
- Shortest Cycle in an Undirected Graph (Multi-Root BFS Queue)Queue · Breadth-First Search · GraphMedium
- Shortest Path with Minimum Turns in a Grid (0-1 BFS)Queue · Breadth-First Search · GraphMedium
- Longest Cycle in a Directed Graph (Kahn's Queue In-Degree Elimination)Queue · Breadth-First Search · GraphMedium
- Shortest Path with Periodic Traffic Signals (Priority Queue BFS)Queue · Heap · Shortest Path · GraphMedium
- Scheduled Transit Network Routing (Event-Driven Priority Queue)Queue · Heap · Shortest Path · GraphMedium
- Word Ladder Shortest Transformation via BFSQueue · Breadth-First Search · GraphHard
- 0-1 BFS in a Direction GridQueue · Breadth-First Search · GraphHard
- Shortest Path to Get All Keys (Bitmask State BFS)Queue · Breadth-First Search · GraphHard
- Shortest Path in a Grid with Obstacle EliminationQueueHard
- Shortest Path Visiting All Nodes (Multi-Source Bitmask BFS)Queue · Breadth-First Search · GraphHard
- Cut Off Trees for Golf Event (Chained BFS)Queue · Breadth-First Search · GraphHard
- Shortest Subarray with Sum at Least K (Monotonic Deque)Queue · Deque · Monotonic QueueHard
- Minimum Cost to Reach Destination in TimeQueueHard
- Escape a Large Maze (Bounded BFS Queue)Queue · Breadth-First Search · GraphHard
- Trapping Rain Water II (Priority Queue 2D Boundary BFS)Queue · Heap · Shortest Path · GraphHard
- Sliding Window Median (Dual Balanced Priority Queues)Queue · Heap · Shortest Path · GraphHard
- Minimum Moves to Move a Box to Target (Push Box)QueueHard
- Sort Items by Groups Respecting DependenciesQueueHard
- Delivering Boxes from Storage to Ports (DP + Monotonic Deque)Queue · Deque · Monotonic QueueHard
- Minimum Reverse Operations (Parity-Set BFS Queue)Queue · Breadth-First Search · GraphHard
- The Maze III (Rolling Ball with Lexicographical Shortest Path)Queue · Breadth-First Search · GraphHard
- Strange Printer II (Bounding Box Dependency Queue)QueueHard
- Build a Matrix With Conditions (2D Dual Topological Sort)QueueHard
- Reachable Nodes in Subdivided Graph (Priority Queue BFS)Queue · Heap · Shortest Path · GraphHard
- All Shortest Paths via Bidirectional BFS (Word Ladder Reconstruction)Queue · Breadth-First Search · GraphHard
- Shortest Walk Distance from All Buildings (Repeated BFS)Queue · Breadth-First Search · GraphHard
- Race Car State-Space BFSQueue · Breadth-First Search · GraphHard
- Shortest Path with Electric Vehicle Battery ConstraintQueueHard
- Cat and Mouse (Retrograde Analysis via In-Degree Queue)Queue · Game Theory · GraphHard
- Minimum Insertions for a Target Subsequence (LIS and Binary Search)Queue · Binary Search · Longest Increasing SubsequenceHard
- Minimum Moves to Reach Target with Rotations (Snake BFS)Queue · Breadth-First Search · GraphHard
- Critical Path and Project Duration in DAG (Kahn's Queue)QueueHard
- 2D Monotonic Deque for Submatrix Maxima in O(M × N)Queue · Deque · Monotonic QueueHard
- Maximum Subarray XOR with Length in [L, R] (Trie + Sliding Window Queue)Queue · Trie · Bit ManipulationHard
- Shortest Path with Dynamic Fuel Recharging and Variable PricingQueue · Heap · Shortest Path · GraphHard
- Dial's Algorithm for 0-K Integer Weighted Shortest PathsQueueHard
- Sliding Window X-th Smallest Element (Fenwick Tree and FIFO Eviction)Queue · Fenwick Tree · Order StatisticsHard
- Maximum Weight Distance-Separated Tree Subset (Tree DP)Queue · Tree · Dynamic ProgrammingHard
- Shortest Common Superstring (Bitmask Priority Queue BFS)Queue · Heap · Shortest Path · GraphHard
- Slope Trick for Optimal Monotonic Sequence (Priority Queue)Queue · Heap · Dynamic ProgrammingHard
- Shortest Weighted Path with At Most K Reverse Traversals (State Dijkstra)Queue · Breadth-First Search · GraphHard
- Feasible Circulation with Demands via Dinic's BFS QueueQueue · Graph · Network FlowHard
- Cat and Mouse II (Grid Retrograde In-Degree Queue)Queue · Game Theory · GraphVery hard
- Escape the Spreading Fire with Maximum Safe DelayQueueVery hard
- FIFO Push-Relabel Maximum Flow AlgorithmQueue · Graph · Network FlowVery hard
- Multi-Box Sokoban (Dual Box Nested BFS)Queue · Breadth-First Search · GraphVery hard
- Dinic's Algorithm for Maximum Flow (BFS Level Graph)Queue · Graph · Network FlowVery hard
- 15-Puzzle Solvability and Frontier Queue SearchQueueVery hard
- Suurballe's Algorithm for Two Edge-Disjoint Shortest PathsQueue · Graph · Network FlowVery hard
- Movable Bridges Multi-State BFSQueue · Breadth-First Search · GraphVery hard