/*kotlin

fun main(args : Array<String>){

    val br = BufferedReader(InputStreamReader(System.`in`))


    val n = br.readLine().toInt()

    val visit = Array(n + 1){false}

    val answer = Array(n + 1){0}

    visit[1] = true


    val tree = Array(n+1){ mutableListOf<Int>() }

//-> mutableListOf를 ArrayList<Int>()


    repeat(n-1){

        val (a, b) = br.readLine().split(" ").map{it.toInt()}

        tree[a].add(b)

        tree[b].add(a)

    }


    val q = LinkedList<Int>()

    for(child in tree[1]){

        q.add(child)

        answer[child] = 1

        visit[child] = true

    }


    while (!q.isEmpty()){

        val parent = q.poll()


        for(child in tree[parent]){

            if (visit[child])continue


            q.add(child)

            answer[child] = parent

            visit[child] = true

        }

    }


    for (node in 2 .. n){

       print(“${answer[node]}\n")

    }

}


*/

관련 코드는 이거야

tree변수 선언 및에 달린 주석처럼 arrayList랑 mutablelistof랑 시간 복잡도 차이가 남...

레퍼런스랑 관련 게시글 찾아보니, 최근 kotlin은 mutableList도 arrayList를 사용하네... 어디서 내가 내용을 놓칠걸깜...