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
|
5571 Discussions
|
Please Login in order to post a comment
In C#
Not the most efficient, but helps with readability.
Java - here is my solution, thanks for watching
Python Solution
Swift
Python soloution def diagonalDifference(arr): lst1=[] lst2=[] for i in range(len(arr)): lst1.append(arr[i][0+i]) lst2.append(arr[i][-1-i]) return abs(sum(lst1)-sum(lst2))