Medium Yahoo Interview Questions: Strategy Guide
How to tackle 32 medium difficulty questions from Yahoo — patterns, time targets, and practice tips.
Medium Yahoo interview questions at the "Medium" difficulty level typically focus on core data structures and algorithms, requiring clean implementation and clear communication. These problems are designed to assess your fundamental problem-solving skills, not obscure tricks. Expect to manipulate strings, arrays, trees, and graphs, applying standard patterns with careful attention to edge cases.
Common Patterns
Yahoo's Medium questions frequently test a few key areas. Recognizing these patterns is crucial for a quick start.
Array/String Manipulation: Problems often involve in-place operations, sliding windows, or two-pointer techniques. You'll need to traverse and transform data efficiently.
# Two-pointer: Remove duplicates from sorted array in-place
def removeDuplicates(nums):
if not nums:
return 0
write = 1
for read in range(1, len(nums)):
if nums[read] != nums[read-1]:
nums[write] = nums[read]
write += 1
return write
Tree Traversal: Binary tree problems, especially involving DFS (Depth-First Search) for path finding or property validation, are common. Hash Map for Frequency/Index Tracking: Many problems reduce to efficiently checking for the existence of an element or counting occurrences.
Time Targets
In a 45-60 minute interview, you should aim to solve a Medium problem within 25-30 minutes. This timeline includes:
- First 5 minutes: Understand the problem, ask clarifying questions, and discuss your initial approach (brute force).
- Next 5-10 minutes: Explain and derive the optimal approach, including time/space complexity.
- Next 10-15 minutes: Write clean, syntactically correct code in your chosen language.
- Remaining time: Walk through test cases, handle edge cases, and discuss potential optimizations. Practice under timed conditions to build this pace.
Practice Strategy
Don't just solve questions. Use them to build pattern recognition and robust implementation skills.
- Categorize by Pattern: When you practice, group Yahoo's Medium questions by the pattern (e.g., "Sliding Window," "BFS"). This reinforces the mental library you need.
- Implement Fully: Always write executable code. Verbal reasoning isn't enough; interviewers evaluate your ability to translate logic into bug-free code.
- Simulate the Interview: For each problem, time yourself and verbalize your thought process out loud. This practices communication under pressure.
- Review Edge Cases: After solving, systematically consider empty inputs, single-element cases, and large values. Write these down.
Focus on consistent, clear solutions over clever but opaque ones.