InterviewStack.io LogoInterviewStack.io

Medium Difficulty Coding Problems Questions

Practice and master medium difficulty algorithmic coding problems that commonly appear in technical interviews. Topics include arrays, strings, linked lists, trees, graphs, hash tables, and dynamic programming. Typical techniques to know are two pointer methods, sliding window, breadth first search and depth first search, recursion and backtracking, memoization and bottom up dynamic programming, sorting and greedy heuristics, and common data structure operations. Interviewers evaluate systematic problem solving: clarifying requirements, designing a correct solution, explaining time and space complexity, handling edge cases and input validation, writing clean and working code in your chosen language, and then iterating to optimize performance. Candidates should be comfortable explaining tradeoffs between approaches, testing with example cases, and communicating thought process clearly while coding under time constraints.

HardTechnical
51 practiced
You receive logs from several services with unsynchronized clocks. Implement in Python an event ordering function that, given events each with a local timestamp and a service id, produces a plausible total order using Lamport timestamps or logical clocks. Provide code to assign Lamport timestamps and then sort events deterministically. Discuss tie-break rules.
MediumTechnical
46 practiced
Given a simulated filesystem with files represented as (path, content), implement find_duplicate_files(files) in Python that returns groups of file paths with identical content. Optimize for large files by using hashing in stages: size, partial hash, and full hash. Discuss collision handling and memory trade-offs.
MediumTechnical
86 practiced
Implement an LRU cache class in Python with methods get(key) and put(key, value). The cache must run both operations in O(1) time, support a configurable capacity, and evict the least recently used item when full. Provide a short example usage and explain how this is useful for caching in SRE automation.
MediumTechnical
53 practiced
Given N services and a list of dependency pairs (A depends on B), implement in Python a function that detects if the dependency graph has cycles. If acyclic, return a valid deployment order using topological sort. Inputs: services as list of strings, dependencies as list of pairs [A,B]. Explain complexity and how this maps to deployment orchestration.
HardTechnical
63 practiced
Given a directed graph where edges have latency weight and each edge also has a reliability probability between 0 and 1, implement in Python an algorithm to find a path from source to target that maximizes overall reliability subject to total latency <= L. Input sizes are small enough to allow pseudo-polynomial solutions. Outline stateful Dijkstra-like DP and implement it.

Unlock Full Question Bank

Get access to hundreds of Medium Difficulty Coding Problems interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.