InterviewStack.io LogoInterviewStack.io

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

Given an array where one value appears more than n/2 times, find it in O(n) time and O(1) extra space (no counting map). Explain why the Boyer-Moore voting idea, canceling out pairs of different values, is guaranteed to leave the majority value standing.

HardTechnical
32 practiced

Given an unsorted array of integers, find the smallest positive integer that is missing from it, in O(n) time and O(1) extra space. Explain the cyclic-sort trick of placing each value at its 'home' index as you scan, and why that gives you O(1) space instead of a hash set.

EasyTechnical
33 practiced

Given a string containing only the bracket characters ( ) { } [ ], determine whether it is validly nested: every closing bracket matches the most recently opened bracket of the same type. Solve it in O(n) time and explain what data structure makes 'most recently opened' cheap to query.

EasyTechnical
33 practiced

Compare a recursive and an iterative implementation of the same simple function (say, factorial). When does recursion make the solution clearer, what does it cost you in call-stack usage, and when would you convert to an iterative or tail-recursive form instead?

MediumTechnical
65 practiced

Given an array that may contain negative numbers and a target sum k, find the length of the longest contiguous subarray whose elements sum to exactly k, in O(n) time. Explain why a sliding window does not work once negative numbers are allowed, and how tracking prefix sums in a hashmap recovers an O(n) solution.

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.