← All problemsSign in

Design the Rectangles

Rory is asked to create a matrix following a certain algorithm. He is given the order of the matrix $P$ x $Q$. Chef decides to consider the matrix as a cascade of rectangles formed by either a set of $Xs$ and $0s$ where X belongs to the set $[1, 9]$ . The rectangles have to be alternating i.e the outer rectangle of the matrix must be of $1s$ and the next one must be of $0s$, the next one must be

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start