← All problemsSign in

Filling Matrix

You have $N^2$ boxes arranged in the form of a square matrix, and you also have infinite balls of 3 different colors. You have to fill all of the boxes by putting a colored ball into it. It is easy to see that the total number of distinct ways to fill all the boxes would be $3$N*N (Each of the boxes can have one of the $3$ colored balls in it). Try all of these different combinations. At the end

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