~/problems
Problems
Basics first, then the classics, then company-style assessments. Every problem has tests you run right here; multi-level ones unlock as you go. See the roadmap.
Math and matrices
Digit-by-digit arithmetic, matrix rotation and in-place tricks.
Main path: 8 problems, about 2 hours.
Notes
Recognise it when: the input is a grid to transform in place, or numbers too big (or too awkward) to handle directly.
- Rotate a square matrix 90° clockwise: transpose, then reverse each row. Layers work too.
- In-place markers: reuse the first row and column (or a sign bit) to remember what to change, so no extra matrix is needed.
- Digit arithmetic: walk from the least significant digit, carry to the next; a result of length
len(a) + len(b)is enough for a product. - Cycles in a sequence of numbers (e.g. repeatedly transforming a value): detect them with a set or with fast/slow pointers.
Common mistakes: changing cells you still need to read; forgetting the final carry; off-by-one on layer boundaries.
10 problems
Interview roadmap
Math & matrices Digit arithmetic, rotating and marking grids in place.
- Play first: The Crooked Portrait 1-minute game Rotate a grid in place
- Walk the outer ring of a grid basics py · c++ · java easy
- Plus One py · c++ · java easy
- Happy Number py · c++ · java easy
- Roman to Integer py · c++ · java easy
- Excel Sheet Column Title py · c++ · java easy
- Reverse Integer py · c++ · java medium
- Rotate Image code the boss py · c++ · java medium
- Set Matrix Zeroes py · c++ · java medium
More practice: 2 problems
- Pow(x, n) py · c++ · java medium
- Multiply Strings py · c++ · java medium