Linked Lists, Stacks, and Queues Questions

Pointer-based linear structures and the classic problems built on them: singly, doubly and circular linked lists (reversal whole, partial and in groups of k, cycle detection and cycle start with fast/slow pointers, intersection, middle and nth-from-end, merging two or k sorted lists, sorting a list, reordering, palindrome check, rotation, partitioning, duplicate removal, deep copy with random pointers, flattening child lists, sentinel nodes), implementing lists in C, C++ and Rust with attention to pointer handling, ownership and cleanup, array versus linked-list trade-offs including cache locality, stacks, queues and deques (array, linked and circular-buffer implementations, ring-buffer full versus empty, queue from two stacks, min stack, round-robin scheduling), monotonic stacks and queues (next greater element, largest rectangle in a histogram, sliding-window maximum), stack-based expression and bracket evaluation (balanced brackets, Reverse Polish Notation, infix to postfix, calculators), and structure-level builds such as an LRU cache from a hash map plus doubly linked list, undo/redo history, and variants like persistent or unrolled lists. Foundational for coding interviews and for understanding how higher-level structures are built. Concurrent and lock-free queues, memory allocators, general graph traversal, heaps and cache-eviction system design are covered elsewhere.

MediumTechnical
51 practiced

Design an iterator for a custom linked list that fails fast: it throws if the list is structurally modified during iteration by anything other than the iterator itself. Show how you detect the modification and what the iterator's remove does.

EasyTechnical
40 practiced

Return the middle node of a singly linked list in one pass and O(1) space. For an even-length list, say which of the two middle nodes you return and why, and explain how your method lands on it.

MediumTechnical
51 practiced

Implement an LRU cache with a fixed capacity and O(1) get and put, without using a built-in ordered or LRU map. Explain which structures you combine and why one alone is not enough, and show how eviction and a get both update recency.

MediumTechnical
48 practiced

Evaluate a Reverse Polish Notation expression given as a list of tokens, supporting integers and + - * /. For example ['2','1','+','3','*'] gives 9. Specify how division should truncate and how you handle malformed input.

EasyTechnical
39 practiced

A non-negative integer is stored in a singly linked list with the most significant digit at the head. Add one to it and return the new head, without converting the list to a number.

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.