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.

EasyTechnical
0 practiced
Explain amortized analysis and show why appending to a dynamic array that doubles its capacity leads to amortized O(1) append. Walk through the aggregate or potential method and show total cost after n appends. Also discuss amortized behavior for hash table insert with resizing and what resizing factors change the amortized cost.
EasyTechnical
0 practiced
Implement a Python function top_k(nums, k) that returns the k largest elements from an unsorted list of integers in O(n log k) time using a heap. Explain why this is preferable to sorting when k is much smaller than n. Provide a brief memory usage estimate.
EasyTechnical
0 practiced
Given a sorted array of integers nums, implement a Python function remove_duplicates(nums) that removes duplicates in place such that each element appears only once and returns the new length. Use O(1) extra space and O(n) time. Example: nums = [0,0,1,1,1,2,2,3] -> new length 4 and array starts with [0,1,2,3]. Explain the two pointer technique applied here.
EasyTechnical
0 practiced
Given a text file that comfortably fits into memory, design and implement (in Python pseudocode) a deduplication routine that outputs unique lines while preserving first occurrence order. Discuss time and space complexity and memory estimates assuming average line length and expected unique count.
MediumTechnical
0 practiced
You receive a very high-volume data stream and need to compute an approximate distinct count with small memory. Explain the HyperLogLog algorithm, its error guarantees, how to choose precision parameter p for a target error rate, and how to merge partial estimates from partitions. Discuss when HLL is appropriate versus exact counting.

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.