There is defined a magic square as a square n-by-n array of positive integers such that the sum of each row, column, and diagonal is the same constant. A normal magic square is an n-by-n magic square composed of the integers 1, 2, ..., n2. For example, the following magic square is a normal magic square composed of the integers 1 through 16, or 42: , The sum of each row, column, and diagonal is 34. Normal magic squares exist that are three by three or larger. If you have an array list of n2 objects of type Integer, where n is greater than 2, write code that tests whether a normal magic square can contain only the integers represented by the objects in the list.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here