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
34 practiced

You need the running mean (and optionally variance) of a numeric stream that is too large to store in full, updated one value at a time in a single pass, and numerically stable over a very long run. Design the update rule, and explain how you would combine two such running statistics computed independently on separate machines.

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.

MediumTechnical
37 practiced

Design a structure over a fixed-size integer array that supports both range-sum queries and point updates in O(log n) time; scanning the array on every query is too slow once updates are frequent. Implement the structure and its two core operations, and explain what makes each one O(log n) rather than O(n).

MediumTechnical
37 practiced

Given a binary tree and two of its nodes, find their lowest common ancestor: the deepest node that has both as descendants. Does your approach change if you know the tree is a binary search tree rather than a general binary tree?

EasyTechnical
38 practiced

Walk through preorder, inorder, and postorder traversal of a binary tree, and separately, level-order (breadth-first) traversal. Implement level-order traversal, returning the values grouped by depth, and explain which of the four traversal orders you would pick to reconstruct a tree from a serialized form, and why.

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.