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
Given a string s implement in Python a function that returns the index of the first non-repeating character or -1 if none exists. Aim for O(n) time and O(1) additional space assuming ASCII character set. Discuss trade-offs and changes required to support Unicode or very large character sets.
MediumTechnical
0 practiced
Implement in Java a function that given an array of positive integers representing vertical line heights computes the maximum area of water container between two lines using the two-pointer technique. The solution should run in O(n) time and O(1) extra space. Explain why moving the pointer at the smaller height is correct.
HardSystem Design
0 practiced
You need to sort 1 TB of data stored on disk but you have only 4 GB of RAM. Design an external sort solution (external merge sort) describing phases: chunking/sampling, in-memory sort, writing sorted runs, multi-way merge, choosing merge fan-in, buffer management, and minimizing disk I/O passes. Estimate number of I/O passes and discuss fault tolerance and parallel/distributed extensions.
EasyTechnical
0 practiced
Implement a function in Python that given an array of integers nums and an integer k returns the maximum sum of any contiguous subarray of size k. Assume k > 0 and k <= len(nums). Use an O(n) sliding window algorithm, explain why it is O(n) and O(1) extra space, and describe how you would return the subarray indices as well as the sum.
HardTechnical
0 practiced
Implement Dijkstra's algorithm in Java using a priority queue to compute shortest path distances from a source in a weighted graph with non-negative weights. Specify input format (edge list or adjacency list), explain why the algorithm fails with negative weights and describe alternatives such as Bellman-Ford and Johnson's algorithm. Also discuss implementation optimizations like lazy deletion versus decrease-key.

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.