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

Given a string and a dictionary of words, determine whether the string can be segmented into a sequence of dictionary words (spaces inserted only between whole words). Then extend it: instead of true/false, return every valid way to insert the spaces. Discuss how you would avoid recomputing the same suffix's answer across the different segmentations.

MediumTechnical
44 practiced

Given a large collection of items, find the k most frequent ones. Compare maintaining a heap of size k as you scan against bucket-sort-by-frequency, and say which one you would pick when k is very small relative to the number of distinct items, versus when it is not.

MediumTechnical
38 practiced

Given a set of items, each with a weight and a value, and a capacity budget, choose a subset that maximizes total value without exceeding the budget, where each item can be taken at most once. Explain the DP state you use and how it changes if you only need to know whether some exact target sum is achievable at all, rather than the maximum value.

MediumTechnical
31 practiced

Check whether a given string reads the same forwards and backwards (ignoring case and non-alphanumeric characters), using two pointers closing in from both ends in O(n) time. Then extend it: find the longest palindromic substring anywhere in a string, using the expand-around-center technique, and explain when it would be worth reaching for Manacher's O(n) algorithm instead.

EasyTechnical
58 practiced

Reverse a singly linked list in place and return the new head, in O(n) time and O(1) extra space. Walk through both the iterative and the recursive version, and note what the recursive one costs you that the iterative one does not.

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.