Medium20 pts
Forming a Magic Square
3x3 matrix. Convert to magic square (row/col/diag sum 15) with min |change|. Return total cost (treat each change as 1).
Input
3 lines of 3 ints.
Output
Min cost.
Sample
4 9 2 3 5 7 8 1 5
Expected
1
Loading editor…
Output
No output yet. Run your code to see results.