YJ의 새벽
프로그래머스(0) - 삼각형의 완성조건(1) 본문
- 삼각형의 완성조건(1)
class Solution {
public int solution(int[] sides) {
int answer = 0;
Arrays.sort(sides);
if(sides[2] >= sides[0]+sides[1] ) {
answer = 2;
}else {
answer = 1;
}
return answer;
}
}
'코딩테스트연습 > 프로그래머스' 카테고리의 다른 글
프로그래머스(0) - 문자 반복 출력하기 (0) | 2024.03.13 |
---|---|
프로그래머스(0) - 최댓값 만들기(1) (0) | 2024.03.13 |
프로그래머스(0) - 문자열 안에 문자열 (0) | 2024.03.13 |
프로그래머스(0) - 배열 자르기 (0) | 2024.03.13 |
프로그래머스(0) - 양꼬치 (0) | 2024.03.13 |
Comments