From c1f7120274b3033ac826e46206c8023b30a60516 Mon Sep 17 00:00:00 2001 From: Matej Focko Date: Sun, 10 Dec 2023 19:09:21 +0100 Subject: [PATCH] =?UTF-8?q?problems(swift):=20add=20=E2=80=9C867.=20Transp?= =?UTF-8?q?ose=20Matrix=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Matej Focko --- problems/swift/transpose-matrix.swift | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 problems/swift/transpose-matrix.swift diff --git a/problems/swift/transpose-matrix.swift b/problems/swift/transpose-matrix.swift new file mode 100644 index 0000000..750c82e --- /dev/null +++ b/problems/swift/transpose-matrix.swift @@ -0,0 +1,16 @@ +class Solution { + func transpose(_ matrix: [[Int]]) -> [[Int]] { + var m = Array( + repeating: Array(repeating: 0, count: matrix.count), + count: matrix[0].count + ) + + for y in 0..