The Challenger puzzle by Linus Maurer requires the solver to fill a 4x4 matrix of integers from 1 to 9 to match the given sums of the rows, columns, main diagonal, and anti-diagonal. Four of the numbers are given. Numbers can be repeated, and the solution is not necessarily unique.
Write a function to solve the Challenger. The input will be a matrix resembling the game board. For example, if the input is
NaN NaN NaN NaN 12
0 0 0 4 23
0 1 0 0 11
6 0 0 0 21
0 0 2 0 13
9 20 22 17 12
then the sums of the four columns are 9, 20, 22, and 17. The sums of the rows are 23, 11, 21, and 13, and the sums of the two diagonals are 12 and 12. The four starting numbers are 6, 1, 2, and 4, and zeros indicate the numbers to be determined. Ignore the NaNs. The output of the function should be the 4x4 matrix of numbers. In the example, a valid solution would be
1 9 9 4
1 1 4 5
6 3 7 5
1 7 2 3

Solution Stats

204 Solutions

27 Solvers

Last Solution submitted on Feb 11, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...