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.

MediumTechnical
64 practiced
Given an integer array nums and an integer k, return the total number of continuous subarrays whose sum equals k. The array may contain negative numbers. Implement an O(n) solution using prefix sums and a hash map in your chosen language. Explain why sliding-window alone does not work with negative numbers and handle edge cases.
HardTechnical
54 practiced
Implement a thread-safe bounded blocking queue that supports multiple producers and multiple consumers, with operations put and take that block when the queue is full or empty respectively. Provide an implementation in Java or Python using locks and condition variables, and discuss correctness, fairness, and potential deadlocks.
MediumTechnical
62 practiced
Implement a function similar to C's atoi that converts a string to a 32-bit signed integer. The function should discard whitespace, handle optional sign, parse digits until non-digit, and clamp overflow to int32 limits. Provide clear behavior for inputs like ' -42' and '4193 with words'.
HardTechnical
50 practiced
Given a directed graph with capacities on edges, implement the Edmonds-Karp algorithm to compute the maximum flow from source to sink. Provide a correct implementation using BFS to find augmenting paths and analyze time complexity O(V * E^2). Discuss alternatives such as Dinic for better performance on large networks.
EasyTechnical
59 practiced
Given a sorted array nums, remove the duplicates in-place such that each element appears only once and return the new length. Do not allocate extra space for another array and modify the input array in-place with O(1) additional memory. Explain the two pointer approach and how to handle arrays of size zero or one.

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.