InterviewStack.io LogoInterviewStack.io

Algorithmic Problem Solving Questions

Evaluates ability to decompose computational problems, design correct and efficient algorithms, reason about complexity, and consider edge cases and correctness. Expectation includes translating problem statements into data structures and algorithmic steps, justifying choices of approach, analyzing time and space complexity, optimizing for constraints, and producing test cases and proofs of correctness or invariants. This topic covers common algorithmic techniques such as sorting, searching, recursion, dynamic programming, greedy algorithms, graph traversal, and trade offs between readability, performance, and maintainability.

EasyTechnical
94 practiced
Given an array of integers (positive, zero, or negative) and an integer k, implement a Python function to compute the maximum sum of any contiguous subarray of size exactly k in O(n) time and O(1) extra space. Provide an example input/output and discuss edge cases such as k larger than array length.
MediumTechnical
71 practiced
Implement an LRU cache class in Python with get(key) and put(key, value) operations in O(1) time. The cache should have a capacity and evict the least-recently-used item when full. Then discuss how you'd test and make the cache safe for a multithreaded model-serving process.
HardTechnical
69 practiced
Define competitive ratio for online algorithms and analyze the performance of LRU cache eviction compared to the clairvoyant offline optimal (Belady). Discuss known lower/upper bounds and explain randomized marking algorithms' guarantees. Provide intuition or sketches of proofs.
MediumTechnical
81 practiced
Compare AVL trees and red-black trees: explain how each maintains balance, insertion rotation cases, invariants, and worst-case height. For an ordered index used heavily for reads and occasional writes in a model-serving system, which would you choose and why?
EasyTechnical
81 practiced
Write a Python function that checks whether a 32-bit signed integer is a power of two using bit operations only (no loops or built-in log). Explain edge cases for zero and negative numbers and state time and space complexity.

Unlock Full Question Bank

Get access to hundreds of Algorithmic Problem Solving interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.