This commit is contained in:
krahets
2024-04-07 03:05:15 +08:00
parent aea68142f8
commit d8caf02e9e
21 changed files with 118 additions and 101 deletions

View File

@@ -1820,9 +1820,9 @@ Quadratic order is common in matrices and graphs, where the number of elements i
/* 平方阶 */
fun quadratic(n: Int) {
// 矩阵占用 O(n^2) 空间
val numMatrix: Array<Array<Int>?> = arrayOfNulls(n)
val numMatrix = arrayOfNulls<Array<Int>?>(n)
// 二维列表占用 O(n^2) 空间
val numList: MutableList<MutableList<Int>> = arrayListOf()
val numList = mutableListOf<MutableList<Int>>()
for (i in 0..<n) {
val tmp = mutableListOf<Int>()
for (j in 0..<n) {