반응형
특정 문자 제거하기
class Solution {
public String solution(String my_string, String letter) {
return my_string.replace(letter,"");
}
}
각도기
class Solution {
public int solution(int angle) {
if(angle < 90){
return 1;
}
else if(angle == 90){
return 2;
}
else if(angle < 180){
return 3;
} else {
return 4;
}
}
}
양꼬치
class Solution {
public int solution(int n, int k) {
return n*12000 + k*2000 - n/10*2000;
}
}
짝수의 합
class Solution {
public int solution(int n) {
n = n - n%2;
int answer = 0;
while(n > 0){
answer += n;
n -= 2;
}
return answer;
}
}
728x90
반응형
'CodingTest' 카테고리의 다른 글
프로그래머스 - 특수문자 출력하기 (1) | 2025.04.12 |
---|---|
코딩테스트 입문 - Day 8 (0) | 2025.04.12 |
코딩테스트 입문 - Day 6 (0) | 2025.04.12 |
코딩테스트 입문 - Day 5 (0) | 2025.04.12 |
프로그래머스 - 코딩테스트 입문 Day 4 (0) | 2025.04.12 |