본문 바로가기
반응형

다음에 올 숫자1

프로그래머스 - 다음에 올 숫자 [Kotlin] 나의 풀이class Solution { fun solution(common: IntArray): Int { val temp = IntArray(common.size - 1) var answer: Int = 0 for (i in 0 until common.size - 1) { temp[i] = common[i + 1] - common[i] } if (temp.all { it == temp[0] }){ answer = common.last() + temp[0] }else{ val div = common[1]/common[0] answer = commo.. 2025. 2. 6.
반응형