Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save codeperfectplus/b3f4b2cfadacdd10977ee140c3111f48 to your computer and use it in GitHub Desktop.

Select an option

Save codeperfectplus/b3f4b2cfadacdd10977ee140c3111f48 to your computer and use it in GitHub Desktop.
def diagonalDifference(arr):
# Write your code here
d1 = sum(arr[i][i] for i in range(n))
d2 = sum(arr[i][n-i-1] for i in range(n))
return abs(d1 - d2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment