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
Given an array of bar heights representing a histogram, compute the area of the largest rectangle in the histogram. Implement an O(n) solution using a monotonic stack and explain why the stack yields linear complexity. Discuss edge cases like equal heights and empty histogram.
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'.
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.
EasyTechnical
44 practiced
Given the root of a binary tree, return the inorder traversal of its nodes values using an iterative approach (no recursion). Implement in your chosen language and explain why an explicit stack is necessary. Discuss time and space complexity and behavior on skewed trees.
HardTechnical
62 practiced
Design an algorithm to maintain the median of a stream of integers. Implement data structures that support addNum and findMedian in logarithmic time per insert. Explain how two heaps (a max-heap and a min-heap) are used and how balancing works, and discuss memory and performance implications for high-rate data streams.

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.

40+ Medium Difficulty Coding Problems Interview Questions & Answers (2026) | InterviewStack.io