Simulation Problems for Coding Interviews
20 Simulation problems from real coding interviews, each with test cases you can run online. By difficulty they split into 3 basic, 13 intermediate and 4 advanced. The companies that ask them most often are Google, Amazon, Microsoft, Bloomberg.
Solve a few problems of each level, name the pattern after each one and revisit the ones that needed a hint a week later. Practise stating the time and space complexity and the edge cases before you code.
Coding problems
- Unique Grid Paths (Intermediate)
- Matrix Spiral Order (Intermediate)
- LRU Cache Operations (Basic)
- LFU Cache Operations (Intermediate)
- Queue With Maximum (Intermediate)
- Stack With Middle Operations (Intermediate)
- Spiral Matrix From Linked List (Intermediate)
- Walking Robot Simulation (Intermediate)
- Spiral Matrix III (Intermediate)
- Dice Roll Simulation (Advanced)
- Minimum Total Distance Traveled (Advanced)
- Robot Return to Origin (Basic)
- Robot Printing the Smallest String (Advanced)
- Cherry Pickup Two Robots Down (Advanced)
- Number Spiral Value (Intermediate)
- Value at Position in Spiral Fill (Intermediate)
- Robot Path Distinct Cells Visited (Basic)
- Spiral Diagonal Sum (Intermediate)
- Spiral Order Element (Intermediate)
- Robot Distance After Repeated Program (Intermediate)
Related
Frequently asked questions
How do I get good at simulation problems?
Practise by level, name the pattern after you solve each problem and review the ones you needed hints for. The list is ordered so you can start with the basic ones.
Can I run simulation problems online here?
Yes. Each problem opens in an editor that runs your code against test cases in Java, Python, C++, Go, JavaScript and more.