We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Warmup
- Diagonal Difference
- Discussions
Diagonal Difference
Diagonal Difference
Sort by
recency
|
5883 Discussions
|
Please Login in order to post a comment
Python solution:
def diagonalDifference(arr): sum1 = 0 sum2 = 0 for i in range(0,n): sum1 += arr[i][i] sum2 += arr[i][n-i-1] return abs(sum1 - sum2)
Rate my solution:
let suma01 = 0;
let suma02 = 0;
let n = arr.length;
for(let i = 0; i < arr.length; i++) { for(let j = 0; j < arr.length; j++) {
}
HI this is my solution, what's wrong in this!
def diagonalDifference(arr): # Write your code here first_diagonal = 0 second_diagonal = 0