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
73 practiced
Implement an LRU Cache class in Python with a fixed capacity that supports get(key) and put(key, value) both in O(1) time. You may use built-in ordered dictionaries or implement a hashmap plus a doubly linked list. Provide the class API and explain eviction policy, how you maintain order, and complexity of operations. Also discuss how to make it thread-safe.
MediumTechnical
86 practiced
Given an integer amount and a list of coin denominations implement in Python a function that returns the minimum number of coins required to make the amount using bottom-up dynamic programming (tabulation). Return -1 if the amount cannot be formed. Analyze time and space complexity, and discuss optimizations for large target amounts or many denominations.
HardTechnical
71 practiced
Given a binary matrix of 0s and 1s implement in Python an algorithm to find the area of the largest rectangle containing only 1s. Use the histogram heights approach and compute largest rectangle in histogram for each row with a stack to achieve O(rows * cols) time. Explain correctness and edge cases such as all zeros or single row matrices.
EasyTechnical
72 practiced
Write a recursive Python function to compute the nth Fibonacci number using memoization (top-down dynamic programming). Explain the time and space complexity, contrast with naive exponential recursion and iterative approaches, and discuss recursion depth limitations and alternatives for very large n.
EasyTechnical
76 practiced
Given a sorted array of integers implement in Java int removeDuplicates(int[] nums) that removes duplicates in-place such that each unique element appears only once and returns the new length. You must not allocate extra array space and should use O(1) additional memory. Explain the two-pointers technique used, and analyze time and space complexity. Also describe how you would change your approach if up to two duplicates are allowed.

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.