Algorithmic Problem-Solving and Data Structure Selection Questions

The higher-order meta-skill of attacking an unfamiliar problem: recognizing problem archetypes and mapping them to known techniques, decomposing under constraints, and choosing, composing, or designing the right data structures to meet specified operation costs (LRU cache, min-stack, ordered maps, disjoint-set/union-find). Covers reasoning about trade-offs between competing structures and approaches, working through medium-to-hard problems methodically, handling problem variations, and communicating an approach before coding. The connective-tissue topic that ties the individual structure and algorithm topics together, rather than any single structure or algorithm.

EasyTechnical
32 practiced

Given a sorted array and a target value, find two numbers that add up to the target using O(1) extra space. Explain why sorted order lets you avoid the hashmap you would otherwise need, and how you would adapt the same technique to intersect two sorted arrays.

HardTechnical
40 practiced

When would you reach for a self-balancing tree (AVL or red-black) instead of a plain hash table, given that both can offer average O(log n) or O(1) operations? Focus on what a balanced tree gives you that a hash table fundamentally cannot (ordered iteration, range queries, worst-case guarantees), and where the balancing overhead is not worth paying.

MediumTechnical
45 practiced

Given an unsorted array of integers, find the length of the longest run of consecutive integers (they need not be contiguous in the array), in O(n) time. Explain why sorting first would cost you the O(n) bound, and how a hash set lets you check 'is this the start of a run' in O(1).

EasyTechnical
33 practiced

A graph can be stored as an adjacency list or an adjacency matrix. Compare the two on memory usage, the cost of checking whether an edge exists, and the cost of iterating a node's neighbors, for both a sparse graph and a dense one. Which would you pick for a graph with a million nodes and an average degree of 10, and why?

MediumTechnical
37 practiced

Design a stack that supports push, pop, top, and retrieving the current minimum element, all in O(1) time. A plain stack gives you O(1) push/pop/top for free; explain what you need to add to also answer 'what is the minimum right now' in O(1) without scanning the stack.

Unlock Full Question Bank

Get access to all Algorithmic Problem-Solving and Data Structure Selection interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.