InterviewStack.io LogoInterviewStack.io

Advanced Algorithms and Problem Solving Questions

Comprehensive assessment of advanced algorithmic reasoning, design, and optimization for hard and composite problems. Covers advanced dynamic programming techniques including state compression and bitmask dynamic programming, combinatorial generation and backtracking, recursion and divide and conquer strategies, greedy algorithms with correctness proofs, and advanced graph algorithms such as breadth first search, depth first search, shortest path algorithms including Dijkstra and Bellman Ford, minimum spanning tree, network flow, strongly connected components, and topological sort. Also includes advanced tree and string algorithms such as suffix arrays and advanced hashing, bit manipulation and low level optimizations, algorithmic reductions and heuristics, and complexity analysis including amortized reasoning. Candidates should recognize applicable patterns, combine multiple data structures in a single solution, transform brute force approaches into optimized solutions, prove correctness and derive time and space complexity bounds, handle edge cases and invariants, and articulate trade offs and incremental optimization strategies. At senior levels expect mentoring on algorithmic choices, designing for tight constraints, and explaining engineering implications of algorithm selection.

MediumTechnical
20 practiced
Given n <= 20 items with positive integer weights and capacity W, count the number of subsets whose total weight is <= W. Implement an efficient solution in C++ or Python using bitmask DP or meet-in-the-middle. Describe the time/space trade-offs and how to optimize the meet-in-the-middle counting using sorting and two-pointer technique.
HardTechnical
24 practiced
Implement Dinic's max-flow algorithm in C++ or Java for directed graphs with up to 1e5 edges. Your implementation should build level graphs via BFS and compute blocking flows via DFS. Explain practical optimizations like current-arc optimization and capacity scaling, and analyze when Dinic is preferable to Edmonds-Karp or Push-Relabel.
MediumTechnical
23 practiced
Implement Dijkstra's algorithm in C++ or Python for a weighted directed graph with non-negative weights. Your implementation should return shortest distances from a given source and reconstruct the shortest path to a specified target. Input format: n nodes labeled 0..n-1 and adjacency list of (neighbor, weight) pairs. Aim for O(m log n) time.
HardTechnical
16 practiced
As a senior engineer you must choose an algorithm for a production service under strict 100ms tail latency and limited memory. Option A: approximate linear-time algorithm with ~1% error and predictable memory; Option B: exact algorithm with O(n log n) time and higher memory. Describe how you would evaluate, benchmark, decide which to ship, mitigate risk, roll out (canary/A-B), monitor SLOs, and mentor the team on this technical decision.
MediumTechnical
18 practiced
Describe and implement suffix array construction using the doubling algorithm (O(n log n)) for a string s (n up to 1e5). Produce both the suffix array and the LCP array. Explain correctness and how LCP can be used to answer substring frequency queries efficiently.

Unlock Full Question Bank

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

Sign in to Continue

Join thousands of developers preparing for their dream job.