InterviewStack.io LogoInterviewStack.io

Fundamental Algorithms and Techniques Questions

Covers core algorithmic concepts and problem solving patterns commonly assessed in technical interviews. Topics include searching algorithms such as binary search; sorting algorithms such as merge sort and quick sort; graph traversal methods such as breadth first search and depth first search; recursion and divide and conquer techniques; greedy heuristics; and dynamic programming including memoization and tabulation. Also includes implementation patterns such as two pointers, sliding window, prefix sums, and divide and conquer composition, as well as practical considerations like in place versus out of place implementations, stability for sorting, recursion stack and memory usage, and amortized analysis. Candidates should be able to implement these algorithms correctly, explain correctness and trade offs, analyze time and space complexity using Big O notation for best case average case and worst case, select appropriate approaches given input constraints, combine patterns to solve composite problems, and optimize or refactor solutions while handling edge cases.

MediumTechnical
90 practiced
As an AI Engineer working on tokenization, implement the 'word break' problem in Python: given a string s and a set of dictionary words, return True if s can be segmented into a sequence of dictionary words. Provide a dynamic programming solution with O(n * L) time where L is the max dictionary word length, describe Trie-based optimizations, and discuss applicability to languages without explicit word boundaries.
MediumTechnical
71 practiced
Write an efficient Python function to count the number of set bits in a 64-bit integer. Compare naive bit-by-bit scans, Kernighan's algorithm (x &= x-1), and precomputed lookup-table approaches. Analyze time complexity and discuss vectorization or SIMD/GPU techniques for bulk population counts used in Bloom filters or feature hashing.
MediumTechnical
72 practiced
Implement in Python the 'minimum window substring' function: given strings s and t, find the minimum window in s that contains all characters of t (including duplicates) and return that substring or an empty string. Use sliding window with counters, analyze time/space complexity, and discuss optimizations for large alphabets or Unicode.
MediumTechnical
82 practiced
Implement a solver for the N-Queens problem in Python that returns one valid arrangement or the count of all solutions for N. Use backtracking and demonstrate bitmask optimizations (columns, diagonals, anti-diagonals) to achieve high performance. Explain why bitmasks are faster and discuss time complexity and how to scale up to N=15 efficiently.
HardTechnical
72 practiced
Explain Bellman-Ford algorithm for single-source shortest paths, implement it in Python to compute distances and detect negative cycles reachable from the source, analyze its time complexity, and discuss practical uses and limitations. Explain why Dijkstra is not appropriate for graphs with negative edge weights and relate negative cycles to reward loops in reinforcement learning.

Unlock Full Question Bank

Get access to hundreds of Fundamental Algorithms and Techniques interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.