Skip to content

Commit 0647a1c

Browse files
committed
feat: Done 문자반복출력하기_김민기.md
1 parent 883b42f commit 0647a1c

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# 문자 반복 출력하기
2+
3+
## 문제 설명
4+
문자열 `my_string`과 정수 `n`이 매개변수로 주어질 때, `my_string`에 들어있는 각 문자를 `n`만큼 반복한 문자열을 return 하도록 solution 함수를 완성해보세요.
5+
6+
## 제한사항
7+
- 2 ≤ `my_string` 길이 ≤ 5
8+
- 2 ≤ `n` ≤ 10
9+
- "my_string"은 영어 대소문자로 이루어져 있습니다.
10+
11+
## 입출력 예
12+
|my_string|n|result|
13+
|--------|---|---------|
14+
|"hello"|3|"hhheeellllllooo"|
15+
16+
## 입출력 예 설명
17+
18+
### 입출력 예 #1
19+
- "hello"의 각 문자를 세 번씩 반복한 "hhheeellllllooo"를 return 합니다.
20+
21+
## 나의 풀이
22+
```js
23+
function solution(my_string, n) {
24+
let answer = '';
25+
for (let i = 0; i < my_string.length; i++){
26+
for (let j = 0; j < n; j++){
27+
answer += my_string[i];
28+
}
29+
}
30+
return answer;
31+
}
32+
```
33+

0 commit comments

Comments
 (0)