class Solution {
public int solution(int[] common) {
int answer = 0;
if(common[2]-common[1] == common[1]-common[0])
answer = common[common.length - 1] + (common[1]-common[0]);
else
answer = common[common.length-1] * common[2]/common[1];
return answer;
}
}
'Algorithm > 프로그래머스' 카테고리의 다른 글
[Lv. 1] 자릿수 더하기 (0) | 2023.04.20 |
---|---|
[Lv. 0] 두 수의 연산값 비교하기 (0) | 2023.04.20 |
[Lv. 0] 연속된 자연수의 합 (0) | 2023.04.17 |
[Lv. 0] 종이 자르기 (0) | 2023.04.17 |
[Lv. 0] 문자열 밀기 (0) | 2023.04.14 |
댓글