Skip to content

Instantly share code, notes, and snippets.

@alexnikol
Last active Jun 29, 2020
Embed
What would you like to do?
Magic Square HackerRank - Problem
/*
Sample Input
*/
s =
4 9 2
3 5 7
8 1 5
/*
Sample Output - 1
*/
/*
Explanation
If we change the bottom right value, s[2][2], from 5 to 6 at a cost of |6 - 5| = 1, becomes a magic square at the minimum possible cost.
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment