728x90
class Solution {
public int solution(int[] common) {
int answer = 0;
if(common[1]-common[0]==common[2]-common[1]){
answer = common[common.length-1]+(common[1]-common[0]);
}else{
answer = common[common.length-1]*(common[1]/common[0]);
}
return answer;
}
}
728x90
'Coding Practice > Programmers - Java' 카테고리의 다른 글
[Programmers] Lv0. 숫자 비교하기 (0) | 2023.03.04 |
---|---|
[Programmers] Lv0. 나이출력 (0) | 2023.03.03 |
[Programmers] Lv0. 두수의 곱 (0) | 2023.03.02 |
[Programmers] Lv0. 7의 개수 (0) | 2023.03.01 |
[Programmers] Lv0. 분수 덧셈 (0) | 2022.11.22 |