Sha256: fa02f775e4463df52396acf9f275fabd9e644b0e7242f3bf83a4823def7a3167
Contents?: true
Size: 941 Bytes
Versions: 68
Compression:
Stored size: 941 Bytes
Contents
class Matrix { private description: string rows: number[][] = new Array<number[]>() columns: number[][] = new Array<number[]>() constructor(description: string) { this.description = description this.parseMatrix() } private parseMatrix(): void { this.parseRows() this.parseColumns() } private parseRows(): void { this.rows = this.description.split('\n').map((row) => { return row.split(' ').map((char) => { return parseInt(char, 10) }) }) } private parseColumns(): void { const rowsLength = this.rows.length const columnsLength = this.rows[0].length for (let i = 0; i < columnsLength; i++) { this.columns.push([]) for (let j = 0; j < rowsLength; j++) { this.columns[i].push(this.rows[j][i]) } } } } export default Matrix
Version data entries
68 entries across 68 versions & 1 rubygems