Created
January 18, 2018 11:08
-
-
Save shannonjen/70b9fbd638986a6c1d3dfb71de3917e7 to your computer and use it in GitHub Desktop.
g65 Warm Up, 1/18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create a function that receives a (square) matrix and calculates the sum of both diagonals (main and secondary) | |
// Matrix = array of n length whose elements are n length arrays of integers. | |
// 3x3 example: | |
// diagonals( [ | |
// [ 1, 2, 3 ], | |
// [ 4, 5, 6 ], | |
// [ 7, 8, 9 ] | |
// ] ); | |
// returns -> 30 // 1 + 5 + 9 + 3 + 5 + 7 | |
function diagonals() { | |
//Solution here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment