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.

HardTechnical
0 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.
MediumTechnical
0 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.
MediumTechnical
0 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.
MediumTechnical
0 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.
EasyTechnical
0 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.