repeat(wires.size) {
            val a = wires[it][0] - 1
            val b = wires[it][1] - 1
            P[a][b] = true
            P[b][a] = true
        }
위와 같이 repeat으로 wire.indices를 간단하게 처리할 수 있다.
'코틀린(Kotlin, Java)' 카테고리의 다른 글
| get Data class Field value by Reflect (0) | 2022.05.22 | 
|---|---|
| Array 배열값 행렬 재배치 (0) | 2022.02.27 | 
| 2차원 배열 초기화 (0) | 2022.02.24 | 
| Regex trial in kotlin (0) | 2022.02.23 | 
| 나볼려고 만든 다익스트라 예제 (0) | 2022.02.23 | 
