Forming a Magic Square

  • + 0 comments

    Not as bad a question as some people here make out.

    1. Generate all permutations of list [1,2,3,4,5,6,7,8,9] (the list is a flattened square 3x3 2D array)

    2. Filter for lists that are magic (the criteria are in the question)

    3. Calculate distance from input array to each magic square

    4. Return minimum distance