feat: add Swift codes for graph_operations article (#327)

This commit is contained in:
nuomi1
2023-02-05 15:41:23 +08:00
committed by GitHub
parent 6ad8a66a7c
commit 12034c6af3
5 changed files with 434 additions and 0 deletions

View File

@ -82,4 +82,12 @@ public enum PrintUtil {
let root = TreeNode.listToTree(list: queue)
printTree(root: root)
}
public static func printMatrix<T>(matrix: [[T]]) {
print("[")
for row in matrix {
print(" \(row),")
}
print("]")
}
}