From 8564355d5b1b4c5c07236ed452606a682b6277c8 Mon Sep 17 00:00:00 2001 From: "exercism-solutions-syncer[bot]" <211797793+exercism-solutions-syncer[bot]@users.noreply.github.com> Date: Wed, 21 Jan 2026 23:06:05 +0000 Subject: [PATCH] [Sync Iteration] typescript/matrix/1 --- solutions/typescript/matrix/1/matrix.ts | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 solutions/typescript/matrix/1/matrix.ts diff --git a/solutions/typescript/matrix/1/matrix.ts b/solutions/typescript/matrix/1/matrix.ts new file mode 100644 index 0000000..a027f77 --- /dev/null +++ b/solutions/typescript/matrix/1/matrix.ts @@ -0,0 +1,22 @@ +export class Matrix { + private _rows: number[][]; + private _columns: number[][]; + + constructor(matrix: string) { + this._rows = matrix + .split("\n") + .map(row => row.split(" ").map(Number)); + + this._columns = this._rows[0].map((_, colIndex) => + this._rows.map(row => row[colIndex]) + ); + } + + get rows(): number[][] { + return this._rows; + } + + get columns(): number[][] { + return this._columns; + } +}