InterviewStack.io LogoInterviewStack.io

Linked Lists, Stacks, and Queues Questions

Pointer-based linear structures: singly and doubly linked lists, stacks, queues, and deques. Covers pointer manipulation, cycle detection, reversal, and using LIFO/FIFO ordering to model traversal, undo, and scheduling problems. Foundational for both interview problems and understanding how higher-level structures are built.

HardSystem Design
37 practiced

Design a thread-safe, bounded queue for batching inference requests in a model-serving system. Requirements: (1) fixed capacity, (2) multiple producers (clients) and multiple consumers (model worker threads), (3) low latency for dequeue, (4) backpressure to clients when full. Describe APIs, locking strategy (condition variables vs lock-free), and how to integrate with autoscaling.

HardSystem Design
35 practiced

Design a streaming sliding-window feature aggregator that supports variable-size windows, high throughput, and approximate quantile summaries per window. Explain how you'd combine monotonic-queue techniques for exact max/min with approximate structures (e.g., t-digest, KLL) for quantiles. Discuss memory, accuracy, and parallelization trade-offs for ML feature pipelines.

HardTechnical
41 practiced

Design a lock-free append operation for a singly linked list suitable for concurrent ML data ingestion pipelines. Provide conceptual pseudocode using atomic compare-and-swap (CAS), explain the ABA problem, and recommend memory-reclamation strategies such as hazard pointers or epoch-based reclamation.

MediumTechnical
40 practiced

Extend cycle detection: implement remove_cycle(head) in Python that detects a cycle using O(1) extra space and removes it so the list becomes linear, preserving node identities. Explain the steps and handle cases where the cycle starts at the head or in the middle.

EasyTechnical
36 practiced

Explain the monotonic queue technique and how it computes sliding-window maximums in O(n) time. Provide a short pseudocode and an example (input: [1,3,-1,-3,5,3,6,7], window=3 -> output: [3,3,5,5,6,7]). Explain how monotonic queues are useful for time-series feature engineering in ML pipelines.

Unlock Full Question Bank

Get access to all Linked Lists, Stacks, and Queues interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.