Skip to content

Commit c05268c

Browse files
committed
[level 0] Title: 문자 반복 출력하기, Time: 10.23 ms, Memory: 77.5 MB -BaekjoonHub
1 parent 15ae99e commit c05268c

2 files changed

Lines changed: 76 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# [level 0] 문자 반복 출력하기 - 120825
2+
3+
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/120825)
4+
5+
### 성능 요약
6+
7+
메모리: 77.5 MB, 시간: 10.23 ms
8+
9+
### 구분
10+
11+
코딩테스트 연습 > 코딩테스트 입문
12+
13+
### 채점결과
14+
15+
정확성: 100.0<br/>합계: 100.0 / 100.0
16+
17+
### 제출 일자
18+
19+
2026년 04월 18일 11:23:42
20+
21+
### 문제 설명
22+
23+
<p>문자열 <code>my_string</code>과 정수 <code>n</code>이 매개변수로 주어질 때, <code>my_string</code>에 들어있는 각 문자를 <code>n</code>만큼 반복한 문자열을 return 하도록 solution 함수를 완성해보세요.</p>
24+
25+
<hr>
26+
27+
<h5>제한사항</h5>
28+
29+
<ul>
30+
<li>2 ≤ <code>my_string</code> 길이 ≤ 5</li>
31+
<li>2 ≤ <code>n</code> ≤ 10</li>
32+
<li>"my_string"은 영어 대소문자로 이루어져 있습니다.</li>
33+
</ul>
34+
35+
<hr>
36+
37+
<h5>입출력 예</h5>
38+
<table class="table">
39+
<thead><tr>
40+
<th>my_string</th>
41+
<th>n</th>
42+
<th>result</th>
43+
</tr>
44+
</thead>
45+
<tbody><tr>
46+
<td>"hello"</td>
47+
<td>3</td>
48+
<td>"hhheeellllllooo"</td>
49+
</tr>
50+
</tbody>
51+
</table>
52+
<hr>
53+
54+
<h5>입출력 예 설명</h5>
55+
56+
<p>입출력 예 #1</p>
57+
58+
<ul>
59+
<li>"hello"의 각 문자를 세 번씩 반복한 "hhheeellllllooo"를 return 합니다.</li>
60+
</ul>
61+
62+
63+
> 출처: 프로그래머스 코딩 테스트 연습, https://school.programmers.co.kr/learn/challenges
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Solution {
2+
public String solution(String my_string, int n) {
3+
String answer = "";
4+
5+
for(int i=0; i<my_string.length(); i++){
6+
for(int j=0; j<n; j++){
7+
answer += my_string.charAt(i);
8+
}
9+
}
10+
11+
return answer;
12+
}
13+
}

0 commit comments

Comments
 (0)