● 문제
● 풀이
class Solution {
public StringBuilder solution(int n) {
StringBuilder sb = new StringBuilder();
for(int i = 0; i< n/2; i++){
sb.append("수박");
}
if(n%2 != 0){
sb.append("수");
}
return sb;
}
}
'프로그래머스' 카테고리의 다른 글
[프로그래머스] 문자열 내림차순으로 배치하기_ JAVA (0) | 2023.07.15 |
---|---|
[프로그래머스] 내적_JAVA (0) | 2023.07.15 |
[프로그래머스] 가운데 글자 가져오기_ JAVA (0) | 2023.07.15 |
[프로그래머스] 제일 작은 수 제거하기_ JAVA (0) | 2023.07.14 |
[프로그래머스] 음양 더하기_ JAVA (0) | 2023.07.14 |