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
0 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.
HardTechnical
0 practiced
Given a DAG representing data lineage, design an algorithm to compute all downstream models and dashboards impacted when a base table column changes. Consider caching, incremental recomputation, prioritization (critical dashboards first), and how to handle cycles and versioned datasets. Describe data structures and runtime complexity.
MediumTechnical
0 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.
MediumTechnical
0 practiced
Given an organizational reporting table employees(id INT PRIMARY KEY, manager_id INT NULL), implement in Python a function get_reports(employee_id, depth) that returns all employee ids reporting up to 'depth' levels under the given manager using BFS. Discuss time/space complexity and how you'd implement the traversal efficiently in SQL for very large organizations.
EasyTechnical
0 practiced
Write an ANSI SQL query to compute a 7-day moving average of daily active users (DAU) per product. Given table user_activity(user_id BIGINT, product_id INT, occurred_at DATE). Return columns: product_id, date, dau, moving_avg_7d. Provide sample rows for product_id=10 for dates 2024-01-01..2024-01-08 and explain assumptions about missing dates and late-arriving events. Use window functions.

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.