We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Here is a JavaScript solution, where we generate all possible magic squares, and compare the input square to them to get a list of all possible costs. Then we take the minimum cost, and return it.
Forming a Magic Square
You are viewing a single comment's thread. Return to all comments →
Here is a JavaScript solution, where we generate all possible magic squares, and compare the input square to them to get a list of all possible costs. Then we take the minimum cost, and return it.