Magic Square HackerRank Exercise

Photo by Blake Connally on Unsplash



The solving of this exercise isn’t so difficult. The main issue here is to understand the meaning and specification. I want to define the main parts of the magic square:

  • Items should be the arithmetic progression. Matrix with all number 3 or 4 for example is not a magic square. (It can be helpful if you need to calculate the sum of all items in a huge magic square). So the magic square 3 x 3 should contain only n ^ 2 = 1, 2, 3, 4, 5, 6, 7, 8, 9
  • The order has matter!

My Social Media

LinkedIn Twitter Original Blog Github HackerRank

iOS Software Developer