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
64 practiced
Regular Expression Matching: implement is_match(s, p) in Python supporting '.' which matches any single character and '*' which matches zero or more of the preceding element. Return True if entire string s matches pattern p. Use dynamic programming (memoized recursion or bottom-up DP) to handle the tricky '*' cases. Example: s = 'aab', p = 'c*a*b' -> True.
HardSystem Design
57 practiced
Build an Autocomplete System: design and implement in Python an autocomplete system that, given a prefix, returns the top-k hot sentences (by frequency) that start with that prefix. Support inserting new sentences and updating frequencies. Consider a Trie with top-k suggestions stored at each node, and discuss memory vs query-time tradeoffs.
EasyTechnical
87 practiced
Given the head of a sorted singly-linked list, implement delete_duplicates(head) in Python that deletes duplicate nodes such that each element appears only once. Return the head of the updated list. Target O(n) time and O(1) extra space. Example: input 1->1->2->3->3 -> output 1->2.
MediumTechnical
55 practiced
Longest Substring Without Repeating Characters: given string s, implement length_of_longest_substring(s) in Python that returns the length of the longest substring without repeating characters. Aim for O(n) time using sliding-window/two-pointer technique. Example: s = 'abcabcbb' -> 3. Discuss memory implications for large Unicode inputs.
HardTechnical
51 practiced
Trapping Rain Water: given an array of non-negative integers representing elevation map where width of each bar is 1, implement trap(height) in Python to compute how much water is trapped after raining. Aim for O(n) time and O(1) extra space using two-pointer technique (alternatively stack). Example: [0,1,0,2,1,0,1,3,2,1,2,1] -> 6.

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.