InterviewStack.io LogoInterviewStack.io

Algorithm Design and Analysis Questions

Covers algorithmic problem solving and analysis fundamentals required in technical interviews. Topics include common data structures, sorting and searching, recursion and divide and conquer, dynamic programming, greedy strategies, backtracking, graph algorithms such as breadth first search and depth first search, shortest path and topological sort, string algorithms, and techniques for deriving correct and efficient solutions. Candidates should demonstrate ability to reason about correctness, derive time and space complexity bounds using Big O notation, and discuss scalability and optimization trade offs for large inputs.

MediumTechnical
91 practiced
Describe and implement (in Python) an algorithm to find the top-k most frequent event types in a dataset too large to fit entirely into memory. First describe an exact approach using hashing with external spilling, then outline an approximate streaming approach (Space-Saving or Count-Min Sketch). Implement the exact in-memory version for moderate data and explain error bounds for the approximate approach.
MediumTechnical
83 practiced
Implement a MedianFinder class in Python that supports add_num(num) and find_median() operations for a stream of integers. The class should achieve O(log n) insertion and O(1) median retrieval using two heaps. Provide code, explain invariants, and discuss memory usage.
EasyTechnical
95 practiced
Describe the trade-offs between different sorting algorithms (quicksort, merge sort, heap sort) when sorting large time-series logs for dashboard generation. Consider average and worst-case time, stability, external-memory friendliness, and parallelization. For each algorithm, give a BI-specific scenario where you'd prefer it.
MediumTechnical
75 practiced
As a BI analyst preparing dashboards, you want to find combinations of metrics whose estimated cost sums to a given budget. Given an array of positive integers 'costs' and a target budget B, implement a Python function that returns any subset of indices whose costs sum exactly to B (subset-sum). Use backtracking and optimize with pruning; discuss time complexity and heuristics for practical data sizes.
MediumTechnical
85 practiced
Implement quickselect in Python to find the kth smallest element in an unsorted list in average O(n) time. Use this to compute the 95th percentile of response times for a large in-memory sample and discuss worst-case behavior and mitigations such as random pivoting or introselect.

Unlock Full Question Bank

Get access to hundreds of Algorithm Design and Analysis interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.