Simulation LeetCode Problems: All 144, With Python Solutions
Every problem in this library that LeetCode tags Simulation — 144 in total, 132 of them with a complete Python solution, a worked example and the time and space complexity of the approach.
- 144 problems
- 57 Easy
- 77 Medium
- 10 Hard
Simulation problems by difficulty
Problems with a complete Python solution are listed first, then by ascending problem number.
Easy (57)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 67 | Add Binary | Easy | Bit Manipulation, Math, String +1 |
| 258 | Add Digits | Easy | Math, Number Theory, Simulation |
| 412 | Fizz Buzz | Easy | Math, String, Simulation |
| 415 | Add Strings | Easy | Math, String, Simulation |
| 495 | Teemo Attacking | Easy | Array, Simulation |
| 566 | Reshape the Matrix | Easy | Array, Matrix, Simulation |
| 657 | Robot Return to Origin | Easy | String, Simulation |
| 682 | Baseball Game | Easy | Stack, Array, Simulation |
| 832 | Flipping an Image | Easy | Bit Manipulation, Array, Two Pointers +2 |
| 844 | Backspace String Compare | Easy | Stack, Two Pointers, String +1 |
| 867 | Transpose Matrix | Easy | Array, Matrix, Simulation |
| 999 | Available Captures for Rook | Easy | Array, Matrix, Simulation |
| 1103 | Distribute Candies to People | Easy | Math, Simulation |
| 1252 | Cells with Odd Values in a Matrix | Easy | Array, Math, Simulation |
| 1260 | Shift 2D Grid | Easy | Array, Matrix, Simulation |
| 1275 | Find Winner on a Tic Tac Toe Game | Easy | Array, Hash Table, Matrix +1 |
| 1389 | Create Target Array in the Given Order | Easy | Array, Simulation |
| 1518 | Water Bottles | Easy | Math, Simulation |
| 1560 | Most Visited Sector in a Circular Track | Easy | Array, Simulation |
| 1603 | Design Parking System | Easy | Design, Counting, Simulation |
| 1646 | Get Maximum in Generated Array | Easy | Array, Simulation |
| 1688 | Count of Matches in Tournament | Easy | Math, Simulation |
| 1700 | Number of Students Unable to Eat Lunch | Easy | Stack, Queue, Array +1 |
| 1920 | Build Array from Permutation | Easy | Array, Simulation |
| 1929 | Concatenation of Array | Easy | Array, Simulation |
| 1945 | Sum of Digits of String After Convert | Easy | String, Simulation |
| 2011 | Final Value of Variable After Performing Operations | Easy | Array, String, Simulation |
| 2022 | Convert 1D Array Into 2D Array | Easy | Array, Matrix, Simulation |
| 2073 | Time Needed to Buy Tickets | Easy | Queue, Array, Simulation |
| 2138 | Divide a String Into Groups of Size k | Easy | String, Simulation |
| 2154 | Keep Multiplying Found Values by Two | Easy | Array, Hash Table, Sorting +1 |
| 2169 | Count Operations to Obtain Zero | Easy | Math, Simulation |
| 2180 | Count Integers With Even Digit Sum | Easy | Math, Simulation |
| 2243 | Calculate Digit Sum of a String | Easy | String, Simulation |
| 2293 | Min Max Game | Easy | Array, Simulation |
| 2303 | Calculate Amount Paid in Taxes | Easy | Array, Simulation |
| 2357 | Make Array Zero by Subtracting Equal Amounts | Easy | Greedy, Array, Hash Table +3 |
| 2460 | Apply Operations to an Array | Easy | Array, Two Pointers, Simulation |
| 2500 | Delete Greatest Value in Each Row | Easy | Array, Matrix, Sorting +2 |
| 2549 | Count Distinct Numbers on Board | Easy | Array, Hash Table, Math +1 |
| 2553 | Separate the Digits in an Array | Easy | Array, Simulation |
| 2558 | Take Gifts From the Richest Pile | Easy | Array, Simulation, Heap (Priority Queue) |
| 2562 | Find the Array Concatenation Value | Easy | Array, Two Pointers, Simulation |
| 2582 | Pass the Pillow | Easy | Math, Simulation |
| 2660 | Determine the Winner of a Bowling Game | Easy | Array, Simulation |
| 2682 | Find the Losers of the Circular Game | Easy | Array, Hash Table, Simulation |
| 2696 | Minimum String Length After Removing Substrings | Easy | Stack, String, Simulation |
| 2717 | Semi-Ordered Permutation | Easy | Array, Simulation |
| 2739 | Total Distance Traveled | Easy | Math, Simulation |
| 2744 | Find Maximum Number of String Pairs | Easy | Array, Hash Table, String +1 |
| 2810 | Faulty Keyboard | Easy | String, Simulation |
| 2899 | Last Visited Integers | Easy | Array, Simulation |
| 2946 | Matrix Similarity After Cyclic Shifts | Easy | Array, Math, Matrix +1 |
| 2960 | Count Tested Devices After Test Operations | Easy | Array, Counting, Simulation |
| 2974 | Minimum Number Game | Easy | Array, Sorting, Simulation +1 |
| 157 | Read N Characters Given Read4Premium | Easy | Array, Interactive, Simulation |
| 1243 | Array TransformationPremium | Easy | Array, Simulation |
Medium (77)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 43 | Multiply Strings | Medium | Math, String, Simulation |
| 54 | Spiral Matrix | Medium | Array, Matrix, Simulation |
| 59 | Spiral Matrix II | Medium | Array, Matrix, Simulation |
| 289 | Game of Life | Medium | Array, Matrix, Simulation |
| 498 | Diagonal Traverse | Medium | Array, Matrix, Simulation |
| 537 | Complex Number Multiplication | Medium | Math, String, Simulation |
| 592 | Fraction Addition and Subtraction | Medium | Math, String, Simulation |
| 640 | Solve the Equation | Medium | Math, String, Simulation |
| 735 | Asteroid Collision | Medium | Stack, Array, Simulation |
| 874 | Walking Robot Simulation | Medium | Array, Hash Table, Simulation |
| 885 | Spiral Matrix III | Medium | Array, Matrix, Simulation |
| 946 | Validate Stack Sequences | Medium | Stack, Array, Simulation |
| 950 | Reveal Cards In Increasing Order | Medium | Queue, Array, Sorting +1 |
| 985 | Sum of Even Numbers After Queries | Medium | Array, Simulation |
| 1006 | Clumsy Factorial | Medium | Stack, Math, Simulation |
| 1041 | Robot Bounded In Circle | Medium | Math, String, Simulation |
| 1094 | Car Pooling | Medium | Array, Prefix Sum, Sorting +2 |
| 1222 | Queens That Can Attack the King | Medium | Array, Matrix, Simulation |
| 1324 | Print Words Vertically | Medium | Array, String, Simulation |
| 1404 | Number of Steps to Reduce a Number in Binary Representation to One | Medium | Bit Manipulation, String, Simulation |
| 1409 | Queries on a Permutation With Key | Medium | Binary Indexed Tree, Array, Simulation |
| 1441 | Build an Array With Stack Operations | Medium | Stack, Array, Simulation |
| 1503 | Last Moment Before All Ants Fall Out of a Plank | Medium | Brainteaser, Array, Simulation |
| 1535 | Find the Winner of an Array Game | Medium | Array, Simulation |
| 1545 | Find Kth Bit in Nth Binary String | Medium | Recursion, String, Simulation |
| 1562 | Find Latest Group of Size M | Medium | Array, Hash Table, Binary Search +1 |
| 1583 | Count Unhappy Friends | Medium | Array, Simulation |
| 1599 | Maximum Profit of Operating a Centennial Wheel | Medium | Array, Simulation |
| 1680 | Concatenation of Consecutive Binary Numbers | Medium | Bit Manipulation, Math, Simulation |
| 1701 | Average Waiting Time | Medium | Array, Simulation |
| 1706 | Where Will the Ball Fall | Medium | Array, Matrix, Simulation |
| 1801 | Number of Orders in the Backlog | Medium | Array, Simulation, Heap (Priority Queue) |
| 1806 | Minimum Number of Operations to Reinitialize a Permutation | Medium | Array, Math, Simulation |
| 1823 | Find the Winner of the Circular Game | Medium | Recursion, Queue, Array +2 |
| 1860 | Incremental Memory Leak | Medium | Math, Simulation |
| 1894 | Find the Student that Will Replace the Chalk | Medium | Array, Binary Search, Prefix Sum +1 |
| 1910 | Remove All Occurrences of a Substring | Medium | Stack, String, Simulation |
| 1914 | Cyclically Rotating a Grid | Medium | Array, Matrix, Simulation |
| 2028 | Find Missing Observations | Medium | Array, Math, Simulation |
| 2043 | Simple Bank System | Medium | Design, Array, Hash Table +1 |
| 2075 | Decode the Slanted Ciphertext | Medium | String, Simulation |
| 2079 | Watering Plants | Medium | Array, Simulation |
| 2105 | Watering Plants II | Medium | Array, Two Pointers, Simulation |
| 2109 | Adding Spaces to a String | Medium | Array, Two Pointers, String +1 |
| 2120 | Execution of All Suffix Instructions Staying in a Grid | Medium | String, Simulation |
| 2149 | Rearrange Array Elements by Sign | Medium | Array, Two Pointers, Simulation |
| 2161 | Partition Array According to Given Pivot | Medium | Array, Two Pointers, Simulation |
| 2177 | Find Three Consecutive Integers That Sum to a Given Number | Medium | Math, Simulation |
| 2181 | Merge Nodes in Between Zeros | Medium | Linked List, Simulation |
| 2201 | Count Artifacts That Can Be Extracted | Medium | Array, Hash Table, Simulation |
| 2211 | Count Collisions on a Road | Medium | Stack, String, Simulation |
| 2221 | Find Triangular Sum of an Array | Medium | Array, Math, Combinatorics +1 |
| 2257 | Count Unguarded Cells in the Grid | Medium | Array, Matrix, Simulation |
| 2295 | Replace Elements in an Array | Medium | Array, Hash Table, Simulation |
| 2326 | Spiral Matrix IV | Medium | Array, Linked List, Matrix +1 |
| 2327 | Number of People Aware of a Secret | Medium | Queue, Dynamic Programming, Simulation |
| 2352 | Equal Row and Column Pairs | Medium | Array, Hash Table, Matrix +1 |
| 2365 | Task Scheduler II | Medium | Array, Hash Table, Simulation |
| 2380 | Time Needed to Rearrange a Binary String | Medium | String, Dynamic Programming, Simulation |
| 2390 | Removing Stars From a String | Medium | Stack, String, Simulation |
| 2462 | Total Cost to Hire K Workers | Medium | Array, Two Pointers, Simulation +1 |
| 2482 | Difference Between Ones and Zeros in Row and Column | Medium | Array, Matrix, Simulation |
| 2502 | Design Memory Allocator | Medium | Design, Array, Hash Table +1 |
| 2507 | Smallest Value After Replacing With Sum of Prime Factors | Medium | Math, Number Theory, Simulation |
| 2593 | Find Score of an Array After Marking All Elements | Medium | Array, Hash Table, Sorting +2 |
| 2596 | Check Knight Tour Configuration | Medium | Depth-First Search, Breadth-First Search, Array +2 |
| 2679 | Sum in a Matrix | Medium | Array, Matrix, Sorting +2 |
| 2766 | Relocate Marbles | Medium | Array, Hash Table, Sorting +1 |
| 2961 | Double Modular Exponentiation | Medium | Array, Math, Simulation |
| 348 | Design Tic-Tac-ToePremium | Medium | Design, Array, Hash Table +2 |
| 353 | Design Snake GamePremium | Medium | Design, Queue, Array +2 |
| 544 | Output Contest MatchesPremium | Medium | Recursion, String, Simulation |
| 723 | Candy CrushPremium | Medium | Array, Two Pointers, Matrix +1 |
| 755 | Pour WaterPremium | Medium | Array, Simulation |
| 1756 | Design Most Recently Used QueuePremium | Medium | Design, Array, Linked List +3 |
| 2061 | Number of Spaces Cleaning Robot CleanedPremium | Medium | Array, Matrix, Simulation |
| 2069 | Walking Robot Simulation II | Medium | Design, Simulation |
Hard (10)
| # | Problem | Difficulty | Topics |
|---|---|---|---|
| 68 | Text Justification | Hard | Array, String, Simulation |
| 749 | Contain Virus | Hard | Depth-First Search, Breadth-First Search, Array +2 |
| 1606 | Find Servers That Handled Most Number of Requests | Hard | Array, Ordered Set, Simulation +1 |
| 2056 | Number of Valid Move Combinations On Chessboard | Hard | Array, String, Backtracking +1 |
| 2296 | Design a Text Editor | Hard | Stack, Design, Linked List +3 |
| 2402 | Meeting Rooms III | Hard | Array, Hash Table, Sorting +2 |
| 2532 | Time to Cross a Bridge | Hard | Array, Simulation, Heap (Priority Queue) |
| 2751 | Robot Collisions | Hard | Stack, Array, Sorting +1 |
| 158 | Read N Characters Given read4 II - Call Multiple TimesPremium | Hard | Array, Interactive, Simulation |
| 2534 | Time Taken to Cross the DoorPremium | Hard | Queue, Array, Simulation |
Keep exploring
All LeetCode topicsEvery tag with a page of its own, with the number of problems behind each.LeetCode patternsThe techniques themselves, with a Python template and complexity for each.Curated study listsBlind 75, NeetCode 150 and three more, grouped by pattern.Easy problemsStart here when the data structure is new rather than the problem.
Other topics
- Array1,569
- String672
- Hash Table588
- Math485
- Dynamic Programming481
- Sorting392
- Greedy346
- Depth-First Search289
- Binary Search253
- Database249
- Tree225
- Breadth-First Search223
- Matrix216
- Two Pointers201
- Bit Manipulation194
- Binary Tree174
- Heap (Priority Queue)163
- Prefix Sum157
- Stack157
- Graph138
- Counting126
- Design122
- Sliding Window116
- Backtracking105
When the Simulation problem arrives live
Stealth Interview is a desktop app for macOS and Windows. It reads the coding problem off your screen, returns a working solution with a step-by-step explanation and its time and space complexity, and transcribes what the interviewer is saying — while staying invisible to screen sharing.