You are viewing a single comment's thread. Return to all comments →
Not as bad a question as some people here make out.
Generate all permutations of list [1,2,3,4,5,6,7,8,9] (the list is a flattened square 3x3 2D array)
Filter for lists that are magic (the criteria are in the question)
Calculate distance from input array to each magic square
Return minimum distance
Seems like cookies are disabled on this browser, please enable them to open this website
Forming a Magic Square
You are viewing a single comment's thread. Return to all comments →
Not as bad a question as some people here make out.
Generate all permutations of list [1,2,3,4,5,6,7,8,9] (the list is a flattened square 3x3 2D array)
Filter for lists that are magic (the criteria are in the question)
Calculate distance from input array to each magic square
Return minimum distance