https://school.programmers.co.kr/learn/courses/30/lessons/120889
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr


정답
class Solution {
public int solution(int[] sides) {
int answer = 0;
int a = sides[0];
int b = sides[1];
int c = sides[2];
int max = sides[0];
for(int i=1; i<sides.length; i++)
{
max = Math.max(sides[i],sides[i-1]);
}
if(max< a + b + c - max)
{
answer = 1;
}
else
{
answer = 2;
}
return answer;
}
}
'Java > 프로그래머스' 카테고리의 다른 글
| [JAVA] 프로그래머스 - 가까운 수 (0) | 2024.05.01 |
|---|---|
| [JAVA] SWEA 2027. 대각선 출력하기 (0) | 2024.05.01 |
| [JAVA] 프로그래머스 - 중복된 문자 제거 (0) | 2024.04.30 |
| [JAVA] 프로그래머스 - 배열 원소의 길이 (0) | 2024.04.30 |
| [JAVA] 프로그래머스 - 컨트롤 제트 (0) | 2024.04.30 |