
class Solution {
public int solution(int[] common) {
int answer = 0;
if((common[1]-common[0]) == (common[2]-common[1])) {
int diff = common[1] - common[0];
int lastIndex = common.length - 1;
answer = common[lastIndex] + diff;
}
else{
int ref = common[1]/common[0];
int lastIndex = common.length-1;
answer= common[lastIndex]*ref;
}
return answer;
}
}
쉽게 해결했다