InterviewStack.io LogoInterviewStack.io

Intermediate Algorithm Problem Solving Questions

Practical skills for solving medium difficulty algorithmic problems. Topics include two pointer techniques, sliding window, variations of binary search, medium level dynamic programming concepts such as recursion with memoization, breadth first search and depth first search on graphs and trees, basic graph representations, heaps and priority queues, and common string algorithms. Emphasis is on recognizing problem patterns, constructing correct brute force solutions and then applying optimizations, analyzing trade offs between time and space, and practicing systematic approaches to reach optimal or near optimal solutions.

MediumTechnical
17 practiced
Implement in Python BFS to compute the shortest path (number of edges) between source and target in an unweighted graph given as adjacency list. Return both length and the actual path (list of node ids). Discuss time/space complexity and how to scale to many shortest-path queries efficiently.
MediumTechnical
25 practiced
Implement in Python a function length_of_longest_nonrepeating_substring(s) that returns the length of the longest substring without repeating characters. Use a sliding-window strategy with a hashmap to track last indices. Example: s='abcabcbb' -> 3. Explain why this runs in O(n) time on average and any pathological cases.
MediumTechnical
25 practiced
As a Data Scientist deciding graph storage for friend recommendations, compare adjacency list vs adjacency matrix across: memory for n nodes, time for iterating neighbors, time for edge existence checks, and suitability for sparse/dense graphs. Give thresholds or rules of thumb for picking one representation at scale (millions of users).
HardTechnical
24 practiced
Implement Bellman-Ford in Python to compute shortest paths from a source in a graph that may contain negative-weight edges, and detect any negative-weight cycles reachable from the source. If a negative cycle exists, return indication and an example cycle. Explain why Dijkstra's algorithm may fail with negative edges.
HardTechnical
18 practiced
Design a memory-efficient streaming system to maintain approximate Top-K most frequent items (heavy hitters) over a high-rate event stream (e.g., product views). Explain how you would combine a Count-Min Sketch (CMS) for frequency estimation with a min-heap for candidate heavy hitters, describe error bounds, and outline how to verify or evict false positives.

Unlock Full Question Bank

Get access to hundreds of Intermediate Algorithm Problem Solving interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.