Interview experiences · Capital One
Capital One Senior+ Software Engineer Interview Experience — A Tetris-Style Grid Placement OA Question
OAInterviewed 2026-02
There's an n x m grid of squares, and I need to draw a pattern on it. The pattern is made up of several fixed block shapes, kind of like Tetris. The problem gave 5 figure types: A, B, C, D, E. For A: in a 2x2 square, it only occupies the top-left, top-right, and bottom-left cells. So A is: That is, a U-shape / concave shape with the top-middle cell empty. This should go by the example matrix — fo…
There's an n x m grid of squares, and I need to draw a pattern on it. The pattern is made up of several fixed block shapes, kind of like Tetris. The problem gave 5 figure types: A, B, C, D, E.
For A: in a 2x2 square, it only occupies the top-left, top-right, and bottom-left cells. So A is:
[1, 0, 1]
[1, 1, 1]
That is, a U-shape / concave shape with the top-middle cell empty. This should go by the example matrix — for this kind of CodeSignal question, you usually go by however the shapes are defined in the problem body.
A [[1]]
B [[1, 1, 1]]
C [[1, 1],
[1, 1]]
D [[1, 0],
[1, 1],
[1, 0]]
E [[0, 1, 0],
[1, 1, 1]]
You return an n x m integer matrix, grid. Rules:
- It starts out all 0.
- After the i-th shape is placed, fill the cells it occupies with the number i+1.
- Cells where nothing fits stay 0.
My rough approach was, for each figure: enumerate its possible top-left positions (r, c), check whether it can be placed there, find the first valid position, and fill the corresponding cells with the current figure's number.
Comments
Nothing here yet.
Join in on CSWork →