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.

HardTechnical
104 practiced
Given a graph where edge weights represent latencies with stochastic variability, design an algorithm to compute k disjoint (edge- or vertex-disjoint as appropriate) paths between two services that minimize expected p99 latency using path diversity. Discuss modeling tail behavior, complexity, and heuristics you would use for large graphs.
MediumTechnical
105 practiced
You have M servers and a stream of tasks where each task has a processing time. Design a greedy online algorithm to assign tasks to servers to minimize makespan (maximum server load). Provide algorithm description, complexity, and discuss known approximation ratios (e.g., LPT for offline scheduling). How do these ideas apply when tasks are long-running services vs short jobs?
MediumTechnical
99 practiced
Implement an algorithm to compute the median for every sliding window of size k over an array of integers: Input: nums: List[int], k: int. Output: List[float] of medians for each window position. Aim for O(n log k) time and handle duplicates efficiently in Python. Explain how you remove elements leaving the window.
MediumTechnical
78 practiced
Write a validator in your preferred language that checks whether a string containing brackets '()[]{}' is balanced and properly nested. Input: a single string; Output: boolean. Consider performance for very large input sizes and provide time and space complexity. Example: '({[]})' -> true; '([)]' -> false.
EasyTechnical
103 practiced
Explain breadth-first search (BFS) and depth-first search (DFS). Describe their algorithmic differences, time and space complexities, and typical implementation patterns (iterative vs recursive). For SRE tasks such as service dependency traversal or finding shortest service hops in an unweighted graph, when would you prefer BFS over DFS and why?

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.