728x90
https://school.programmers.co.kr/learn/courses/30/lessons/120889

📝 나의 풀이
using System;
public class Solution {
public int solution(int[] sides) {
int answer = 0;
int max =0;
int index =0;
int sum=0;
for(int i=0; i<3; i++){
if(max<sides[i]){
max = sides[i];
index = i;
}
}
for(int i=0; i<3; i++){
if(i==index){
continue;
} else {
sum+=sides[i];
}
}
if(max<sum){
answer = 1;
} else {
answer = 2;
}
return answer;
}
}
728x90
'코딩테스트 > [C#] 프로그래머스' 카테고리의 다른 글
[프로그래머스 | Lv.0] 중앙값 구하기 (0) | 2023.08.13 |
---|---|
[프로그래머스 | Lv.0] 문자열안에 문자열 (0) | 2023.08.13 |
[프로그래머스 | Lv.0] 두 수의 곱 (0) | 2023.08.13 |
[프로그래머스 | Lv.0] 모음 제거 (0) | 2023.08.13 |
[프로그래머스 | Lv.0] 배열의 유사도 (0) | 2023.08.13 |