Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for [old] Skew-symmetric Matrix by megaexception
"use strict";
function symmetric(matrix) {
return matrix.every((row, i) => row.every((c, j) => c == -matrix[j][i]));
}
var assert = require('assert');
if (!global.is_checking) {
console.log('Example:')
console.log(symmetric([
[0, 1, 2],
[-1, 0, 1],
[-2, -1, 0]]))
// These "asserts" using only for self-checking and not necessary for auto-testing
assert.equal(symmetric([
[0, 1, 2],
[-1, 0, 1],
[-2, -1, 0]]), true);
assert.equal(symmetric([
[0, 1, 2],
[-1, 1, 1],
[-2, -1, 0]]), false);
assert.equal(symmetric([
[0, 1, 2],
[-1, 0, 1],
[-3, -1, 0]]), false);
console.log("Coding complete? Click 'Check' to earn cool rewards!");
}
Jan. 24, 2019