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.

MediumTechnical
43 practiced

You need the shortest path in a weighted graph. Walk through how you would choose between BFS, Dijkstra, Bellman-Ford, and A*, based on whether edges are weighted, whether negative weights are possible, and whether you need single-source or all-pairs distances. When would A*'s heuristic actually help over plain Dijkstra, and what property must that heuristic have?

EasyTechnical
35 practiced

What does it mean for a sorting algorithm to be stable, and why does that matter when you are sorting by a secondary key after already having sorted by a primary one? Name a stable and an unstable sort and say what would break if you used the unstable one in a multi-key sort.

HardTechnical
33 practiced

Extend the eviction policy so the cache tracks how often each key is used, not just how recently: get(key) and put(key, value) must both stay O(1), and when the cache is full it evicts the least-frequently-used entry, breaking ties by least-recently-used. Describe the structures that keep both the frequency count and the recency-within-a-frequency ordering O(1) to update.

MediumTechnical
44 practiced

A candidate (or a teammate) has written a memoized recursive solution to a combinatorial problem, but it still times out or the code has spiraled in complexity. Walk through how you would diagnose whether the issue is a missing memoization key, an avoidable exponential branching factor, or a case where the technique itself (recursion) is the wrong fit, and how you would coach someone through fixing it.

EasyTechnical
36 practiced

Find the contiguous subarray with the largest sum in an array of integers (which may include negative numbers), in O(n) time and O(1) space. Explain the one-pass running-max idea (Kadane's algorithm), why it still works when every number is negative, and how you would adapt it to track the maximum product instead of the maximum sum.

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.