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
70 practiced
Explain and prove the amortized time complexity of append operations on a dynamic array (such as Python list or Java ArrayList) when capacity doubles on resize. Provide aggregate analysis across n appends to show why amortized cost is O(1), and discuss how changing the growth factor affects time and memory trade-offs.
HardTechnical
81 practiced
Design and implement in Java a data structure that supports insert(x), delete(x) and getRandom() all in expected O(1) time. Use an ArrayList and HashMap mapping value to index. After coding, discuss concurrency considerations: how would you make operations thread-safe with minimal contention while preserving expected performance?
MediumTechnical
85 practiced
Implement randomized quicksort in Java for an array of integers using in-place partitioning. Choose pivot randomly to avoid worst-case behavior on already sorted inputs. Analyze average and worst-case time and space complexity, and explain how tail recursion elimination or recursion on smaller partition first can reduce stack depth.
MediumTechnical
111 practiced
Implement in Python a function that returns the length of the longest substring without repeating characters using a sliding window. Your solution should run in O(n) time and use O(min(n, m)) additional space where m is character set size. Explain how to return the substring itself and how the algorithm changes for Unicode inputs with large alphabets.
EasyTechnical
88 practiced
Implement merge sort in Java using an out-of-place approach that returns a new sorted array. Explain why merge sort is stable by default, analyze best, average and worst case time and space complexity, and describe how to convert to an iterative bottom-up merge sort. Also discuss strategies to reduce extra memory usage when memory is constrained.

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.