4
$\begingroup$

enter image description here

1 3 2 3 1
3 3 2 3 3
2 2 3 3 2
3 3 3 4 4
1 3 2 4 1

This 5x5 table has unique properties.
Each number (x) in a cell means :

The cell is surrounded (including diagonal neighbours) by x unique numbers in the squares surrounding it.


Example :
(2,2) cell (red) is 3, so it is surrounded by 3 unique numbers (1,2 and 3)
(4,4) cell (blue) is 4, so it is surrounded by 4 unique numbers (1,2, 3 and 4)

The Question

enter image description here

3 . . . .
. . . . 2
. . . . .
2 . . . .
. . 3 . .

Fill in the blanks so the table has the same unique properties.

$\endgroup$
4
$\begingroup$

One solution, with

entries at most 4. It was found by basic depth-first search with pruning (checking if the neighbouring condition hold at each cell). This is colloquially called as backtracking.

Here it comes:

 3 2 3 3 3
 3 4 4 4 2
 3 4 1 4 3
 2 4 4 4 3
 3 3 3 2 3

Other solutions might be possible. Edit: this is the unique solution.

| improve this answer | |
$\endgroup$
  • $\begingroup$ Edit: this is the unique solution. Why? $\endgroup$ – CodeNewbie Sep 22 '16 at 12:47
  • $\begingroup$ @CodeNewbie see edit summary. It is clear that the value in each of the cells is bounded, so this is a finite problem and the only thing you need to do is to check all cases. $\endgroup$ – Matsmath Sep 22 '16 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.