-
프로그래머스 - 수박수박수박수박수박수 [자바]Algorithms/- 프로그래머스 2022. 2. 2. 11:23
- 문제 링크 : 수박수박수박수박수박수
정답
class Solution { public String solution(int n) { StringBuilder sb = new StringBuilder(); for(int i=0; i<n; i++){ if(i % 2 == 0){ sb.append("수"); }else{ sb.append("박"); } } return sb.toString(); } }
분석
- 문자열 다루기
반응형