일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- css
- html
- programmers
- 시큐리티 로그인
- gradle
- 스프링 부트
- 리눅스
- java
- springboot
- 시큐리티 로그아웃
- 2차원배열
- javascript
- StyleSheet
- Linux
- sql
- 프로그래머스
- 코딩테스트
- codingtest
- 소스트리
- Spring boot
- security
- input태그
- 목록
- 시큐리티
- JAVA11
- 반복문
- springSecurity
- 싱글톤
- 로그인
- 시큐리티로그인
Archives
- Today
- Total
JAVAIARY
프로그래머스 ) 다음에 올 숫자 본문
문제 : https://school.programmers.co.kr/learn/courses/30/lessons/120924
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
public int solution(int[] common) {
int answer = 0;
// 1. 수열의 길이는 항상 3 이상
// 2. 등차수열인지 확인
if (common[1]-common[0]==common[2]-common[1]) {
answer= common[common.length-1]+(common[1]-common[0]);
}
// 3. 그렇지 않은 경우 등비수열
else {
answer = common[common.length-1]*(common[1]/common[0]);
}
return answer;
}
'examplePractice' 카테고리의 다른 글
프로그래머스) 콜라츠 추측 (0) | 2023.02.24 |
---|---|
프로그래머스 ) 분수의 덧셈 (0) | 2023.02.22 |
프로그래머스 ) 최댓값과 최솟값 (0) | 2023.02.18 |
프로그래머스) lv.1 약수의 개수와 덧셈 (0) | 2023.01.30 |
프로그래머스) lv.2 올바른 괄호 (0) | 2023.01.23 |