Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Short solution in Clear category for [old] Skew-symmetric Matrix by SaintDron
"use strict";
const symmetric = (matrix) => matrix.every((row, r) => row.every((v, c) => v === -matrix[c][r]));
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. 1, 2019
Comments: