InterviewStack.io LogoInterviewStack.io

Algorithmic Problem Solving Questions

Evaluates ability to decompose computational problems, design correct and efficient algorithms, reason about complexity, and consider edge cases and correctness. Expectation includes translating problem statements into data structures and algorithmic steps, justifying choices of approach, analyzing time and space complexity, optimizing for constraints, and producing test cases and proofs of correctness or invariants. This topic covers common algorithmic techniques such as sorting, searching, recursion, dynamic programming, greedy algorithms, graph traversal, and trade offs between readability, performance, and maintainability.

HardSystem Design
81 practiced
You need to sort a 500GB file on a machine with 8GB RAM. Design an external merge sort: describe how to create initial runs, multi-way merge strategy, number of passes, I/O complexity, and optimizations such as replacement selection, compression, and parallel merging.
MediumTechnical
84 practiced
Given an integer array, return the k most frequent elements. Implement in Java or Python using a min-heap or quickselect and discuss time/space trade-offs and when to prefer heap vs quickselect. Example: nums=[1,1,1,2,2,3], k=2 => [1,2].
HardTechnical
84 practiced
Provide a rigorous correctness proof for Dijkstra's algorithm (non-negative weights). Explain the invariant maintained when extracting the minimum-distance vertex from the priority queue, use contradiction to show shortest path property, and then discuss why negative edge weights break this property and how Bellman-Ford handles them.
EasyTechnical
74 practiced
Implement a function in Python/Java/C++ that, given an unsorted integer array nums and an integer target, returns indices of two numbers that add to target. Assume exactly one solution and you cannot use the same element twice. Aim for O(n) time and O(n) space. Example: nums = [2,7,11,15], target = 9 => [0,1]. Provide a short explanation of correctness and complexity.
MediumTechnical
138 practiced
Implement an algorithm to compute the length of the Longest Increasing Subsequence (LIS) in O(n log n) time using the patience-sorting (tails) approach in C++/Java. Explain how binary search is used to maintain tails and why tails length equals LIS length. Provide an example.

Unlock Full Question Bank

Get access to hundreds of Algorithmic Problem Solving interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.