File tree Expand file tree Collapse file tree
프로그래머스/1/12930. 이상한 문자 만들기 Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# [ level 1] 이상한 문자 만들기 - 12930
22
3- [ 문제 링크] ( https://school.programmers.co.kr/learn/courses/30/lessons/12930?language=java )
3+ [ 문제 링크] ( https://school.programmers.co.kr/learn/courses/30/lessons/12930 )
44
55### 성능 요약
66
7- 메모리: 75.7 MB, 시간: 0.04 ms
7+ 메모리: 75.9 MB, 시간: 0.05 ms
88
99### 구분
1010
1616
1717### 제출 일자
1818
19- 2026년 06월 22일 21:06:56
19+ 2026년 06월 24일 09:44:10
2020
2121### 문제 설명
2222
Original file line number Diff line number Diff line change @@ -3,16 +3,16 @@ public String solution(String s) {
33 StringBuilder sb = new StringBuilder ();
44 int idx = 0 ;
55
6- for (char c : s .toCharArray ()) {
6+ for (int i = 0 ; i < s .length (); i ++) {
7+ char c = s .charAt (i );
8+
79 if (c == ' ' ) {
8- sb .append (c );
10+ sb .append (' ' );
911 idx = 0 ;
10- } else {
11- if (idx % 2 == 0 ) {
12- sb .append (Character .toUpperCase (c ));
13- } else {
14- sb .append (Character .toLowerCase (c ));
15- }
12+ }
13+ else {
14+ if (idx % 2 == 0 ) sb .append (Character .toUpperCase (c ));
15+ else sb .append (Character .toLowerCase (c ));
1616 idx ++;
1717 }
1818 }
You can’t perform that action at this time.
0 commit comments