Simulation
simulation
Practice Problems
Last Stone Weight
Simulate smashing the two heaviest stones together repeatedly using a max-heap and return the weight of the last remaining stone.
Text Justification
Given an array of words and a maximum width, format the text so that each line has exactly the specified number of characters, fully justified (left and right).
Game of Life
Implement Conway's Game of Life: compute the next state of a board in-place using state-encoding to avoid extra space.
Multiply Strings
Given two non-negative integers represented as strings, return their product as a string. You must not convert the inputs to integers directly or use any built-in BigInteger library.
Snakes and Ladders
Given a Snakes and Ladders board, find the minimum number of dice rolls to reach the final square from square 1.
Spiral Matrix
Return all elements of an m x n matrix in spiral order, traversing from the outer boundary inward.
String to Integer (atoi)
Implement the myAtoi(string s) function, which converts a string to a 32-bit signed integer. Handle leading whitespace, optional sign, digit parsing, and integer overflow/underflow.
Zigzag Conversion
Convert a string to a zigzag pattern across a given number of rows, then read it line by line.
