← All problemsSign in

The Inward Matrix

Form a square matrix whose border is made of numbers, in such a manner that the border is made of a single number. Start from number 1 in the outer border and increase the number as the border converges. Each Matrix with Size S will be a S x S Matrix. Eg. If size is 5, Output should be: 1 1 1 1 1 1 2 2 2 1 1 2 3 2 1 1 2 2 2 1 1 1 1 1 1 Or if size

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