네트워크
-
[프로그래머스][Kotlin] 네트워크프로그래머스 2023. 2. 1. 16:25
import java.util.* class Solution { private var nodeList = mutableListOf() private var visited = mutableListOf() private var answer = 0 fun solution(n: Int, computers: Array): Int { nodeList.add(mutableListOf()) visited.add(true) for(i in 0 .. n-1){ var tempList = mutableListOf() for(j in 0 .. n-1){ if(i == j) { tempList.add(0) } else { if(computers[i][j] != 0){ tempList.add(j+1) } else { tempLi..