Skip to content

Instantly share code, notes, and snippets.

@obiPlabon
Created December 23, 2015 06:48
Show Gist options
  • Select an option

  • Save obiPlabon/0243062053b4e8623915 to your computer and use it in GitHub Desktop.

Select an option

Save obiPlabon/0243062053b4e8623915 to your computer and use it in GitHub Desktop.
Matrix plus diff
function matrixPlusDiff(m) {
var d1 = d2 = 0;
for(var i = 0, l = m.length; i < l; i++){
d1 += m[i][Math.floor(l/2)];
d2 += m[Math.floor(l/2)][i];
}
console.log(d1-d2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment