Grids & Simulation
Square's coding problems include a lot of simulation, and most of it happens on a grid. A ball rolls through a maze until a wall stops it. A robot walks the edge of a rectangle and turns at each corner, or a box tips onto its side and every loose stone falls until something holds it. None of these has a payments story. Each is a process you could run by hand on a small board, and interviewers reward code that runs it the same way.
The six problems come in two kinds. Some are searches with an unusual move, where BFS stays ordinary and only the meaning of one step changes. The rest are simulations whose simple loop is correct but too slow, so the work is index math that replaces the loop. An offset modulo the perimeter replaces walking lap by lap, and a hash keyed on block corners replaces a scan over ten billion blocks. These build on the one-cell-at-a-time grid BFS from Graphs & Trees.
BlockPremium lesson · Coding round
The 6 Block problems are below.
- A Premium questionCoding · Medium
- A Premium questionCoding · Medium
- A Premium questionCoding · Medium
+ 3 more in this lesson
Each with hints, the follow-up and a tested solution.
Get the Block questions$49 a year · all 100 companies · cancel anytime
From 20,000+ candidate reports, forum threads behind logins and write-ups in Chinese.
Block interview guideKnow what Block asks before you walk in.
30 coding · 5 system design · 14 behavioral questions
Get their questions first.
InterviewLegend is independent and not affiliated with or endorsed by any company it covers.