성능 비교

    (백준/Kotlin) 10818번 : 최소, 최대 (시간 복잡도/선형 시간, 메소드 성능 비교)

    (백준/Kotlin) 10818번 : 최소, 최대 (시간 복잡도/선형 시간, 메소드 성능 비교)

    난이도: Bronze 3 프로그래밍 언어: Kotlin 문제명: 최소, 최대 푼일자: 2021년 6월 주소: https://www.acmicpc.net/problem/10818 문제풀기 단순한 선형 시간 O(n) 문제이다. 제출하고, 생각나는 몇가지 방법이 있어 각각 백준에 제출을 해서 성능을 비교해 보았다. MutableList 형에서 지원하는 .min() 과 .max() 를 사용해 보았다. fun resolve1() = with(Scanner(System.`in`)) { nextLine() val r = nextLine().split(" ").map { it.toInt() }.toTypedArray().toList() print("${r.minOrNull()} ${r.maxOrNull()}") } M..