Skip to content

Commit 47835a7

Browse files
[level 0] Title: 문자열 섞기, Time: 0.06 ms, Memory: 33.4 MB -BaekjoonHub
1 parent 55e5c13 commit 47835a7

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# [level 0] 문자열 섞기 - 181942
2+
3+
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/181942)
4+
5+
### 성능 요약
6+
7+
메모리: 33.4 MB, 시간: 0.06 ms
8+
9+
### 구분
10+
11+
코딩테스트 연습 > 코딩 기초 트레이닝
12+
13+
### 채점결과
14+
15+
정확성: 100.0<br/>합계: 100.0 / 100.0
16+
17+
### 제출 일자
18+
19+
2024년 12월 19일 09:13:43
20+
21+
### 문제 설명
22+
23+
<p>길이가 같은 두 문자열 <code>str1</code>과 <code>str2</code>가 주어집니다.</p>
24+
25+
<p>두 문자열의 각 문자가 앞에서부터 서로 번갈아가면서 한 번씩 등장하는 문자열을 만들어 return 하는 solution 함수를 완성해 주세요.</p>
26+
27+
<hr>
28+
29+
<h5>제한사항</h5>
30+
31+
<ul>
32+
<li>1 ≤ <code>str1</code>의 길이 = <code>str2</code>의 길이 ≤ 10
33+
34+
<ul>
35+
<li><code>str1</code>과 <code>str2</code>는 알파벳 소문자로 이루어진 문자열입니다.</li>
36+
</ul></li>
37+
</ul>
38+
39+
<hr>
40+
41+
<h5>입출력 예</h5>
42+
<table class="table">
43+
<thead><tr>
44+
<th>str1</th>
45+
<th>str2</th>
46+
<th>result</th>
47+
</tr>
48+
</thead>
49+
<tbody><tr>
50+
<td>"aaaaa"</td>
51+
<td>"bbbbb"</td>
52+
<td>"ababababab"</td>
53+
</tr>
54+
</tbody>
55+
</table>
56+
57+
> 출처: 프로그래머스 코딩 테스트 연습, https://school.programmers.co.kr/learn/challenges
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
function solution(str1, str2) {
2+
let answer = ""
3+
for (let idx = 0; idx < str1.length; idx++) {
4+
answer += str1.charAt(idx)
5+
answer += str2.charAt(idx)
6+
}
7+
return answer;
8+
}

0 commit comments

Comments
 (0)