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.

EasyTechnical
77 practiced
Explain, with concrete examples, the practical differences between common complexity classes: O(1), O(log n), O(n), O(n log n), O(n^2), and O(2^n). For each class give one algorithm/operation that fits it, and discuss how doubling the input size affects runtime to help an engineer choose algorithms in practice.
HardTechnical
87 practiced
Implement Levenshtein edit distance (insert/delete/replace cost 1) between strings s and t and additionally produce the edit script (sequence of operations) to transform s into t. Provide a Python implementation using O(m*n) time and O(m*n) space, and explain how you would reduce space when only the distance is needed.
MediumTechnical
76 practiced
Given a string s, find the length of the longest substring without repeating characters. Implement in Python using sliding-window with a hashmap to track last seen indices. Example: 'abcabcbb' -> 3. Explain why the algorithm runs in O(n) time and analyze space usage with respect to the character set.
MediumTechnical
94 practiced
Given an array of strings, group anagrams together. Implement in JavaScript: function groupAnagrams(strs) { ... }. Use a hash map where the key is either the sorted string or a character-count signature. Discuss time/space trade-offs and handling of large alphabets or Unicode.
MediumTechnical
73 practiced
Given an unweighted undirected graph represented as an adjacency list and a start node, compute shortest distances (in number of edges) to all reachable nodes using BFS. Implement in Java: Map<Integer,Integer> bfsDistances(Map<Integer,List<Integer>> graph, int start). Explain correctness and O(V+E) time complexity.

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.