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
79 practiced
Implement a BFS in Python that, given an adjacency list representing a customer referral graph, returns the shortest path (list of node ids) between two users A and B. The graph may be large; discuss memory/time trade-offs and how you'd implement bidirectional BFS to speed up the search.
HardTechnical
105 practiced
Explain how HyperLogLog estimates cardinality (distinct counts) in large streams. Describe the intuition, role of hashing and leading-zero counts, register arrays, how to tune memory/configuration, mergeability of HLL sketches, and how you'd integrate HLL into a large-scale BI pipeline to compute daily unique users across partitions. Discuss error bounds and trade-offs.
HardSystem Design
92 practiced
Design a near-real-time metric computation system to process 1M events/second and compute multiple rolling aggregates (per-minute, hourly, daily) per dimension (e.g., product_id, country) with per-key latency under 2 seconds. Describe components (ingest, stream processor, state store), choice of algorithms for windows, handling late arrivals, exactly-once semantics, fault tolerance, and scaling considerations.
HardTechnical
103 practiced
Given a directed weighted graph representing latencies between services in a data pipeline, describe algorithmic choices for computing the least-latency path from service S to all others. Explain when to use Dijkstra vs Bellman-Ford, implement Dijkstra in Python using a heap, and discuss how to scale to graphs with hundreds of millions of edges.
EasyTechnical
80 practiced
Implement a function is_valid_parentheses(s) in Python that returns True if the input string s containing characters '(', ')', '{', '}', '[', ']' is valid (every opening has matching closing and properly nested). The function should run in O(n) time and O(n) space. Provide a clean implementation and a brief explanation of edge cases handled.

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.