class Solution {
public int solution(int[] common) {
int answer = 0;
int size = common.length;
/// 배열의 크기를 구한다.
int lastnum = size-1;
/// 배열의 크기가 10이라면 마지막 항은 9항이다.(배열은 0항 시작)
if(common[1]-common[0] == common[2]-common[1])
/// 1항과 0항의 뺄셈 값 차이가 2항과 1항의 뺄셈 값 차이와 같다면 등차 수열로 판단한다.
answer = common[lastnum]+(common[1] – common[0]);
/// 등차수열이라면 마지막 항에 등차를 더해서 제출한다.
else
/// 배열이 등차수열이 아니라면 등비수열이다.
answer = common[lastnum]*(common[1]/common[0]);
/// 등비수열이라면 마지막 항에 등비를 곱해서 제출한다.
return answer;
}
}
Content for your website https://zetds.seychellesyoga.com/info
Web Development Wizards https://zetds.seychellesyoga.com/info
Can provide a link mass to your website https://zetds.seychellesyoga.com/info
Free analysis of your website https://zetds.seychellesyoga.com/info
I offer mutually beneficial cooperation https://zetds.seychellesyoga.com/info
Cool website. There is a suggestion https://zetds.seychellesyoga.com/info
I really liked your site. Do you mind https://zetds.seychellesyoga.com/info
Here’s what I can offer for the near future https://zetds.seychellesyoga.com/info
You will definitely like it https://zetds.seychellesyoga.com/info
Content for your website https://ztd.bardou.online/adm