JavaScript ~[72 ms, 38 MB]
js\nvar diagonalSum = function(mat) {\n  const len = mat.length\n  let [sum, offset] = [0, 0]\n  for (let i = 0, j = len - 1; i < len; i++, j--) {\n    if (i ==
```js\nvar diagonalSum = function(mat) {\n  const len = mat.length\n  let [sum, offset] = [0, 0]\n  for (let i = 0, j = len - 1; i < len; i++, j--) {\n    if (i === j) offset += mat[i][i]\n    sum += mat[i][i] + mat[i][j]\n  }\n  return sum - offset\n};\n```
['JavaScript']