Hackerrank – Diagonal Difference

Problem Statement
A description of the problem can be found on Hackerrank.

Solution
Make 2 sums for 2 diagonals – from left to right, from right to left.
Substract 2 sums and print its absolute value.

I created solution in 4 languages:

All solutions are also available on my GitHub.

Scala

Java

JavaScript

Ruby