Difference Matrix
You are given an integer $N$. You need to find an $N\times N$ matrix such that: - Each element of the matrix is an integer from $1$ to $N^2$; - All elements of the matrix are **unique**; - The absolute difference between elements in neighbouring cells is **strictly greater** than $1$. It can be shown that there is at least one matrix that satisfies the given conditions. If multiple matrices satis
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.
Sign in to chat with the tutor and save your progress.
Sign in to start