Skip to content

Commit 811b729

Browse files
committed
[level 0] Title: 문자열안에 문자열, Time: 0.04 ms, Memory: 33.5 MB -BaekjoonHub
1 parent 840b581 commit 811b729

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# [level 0] 문자열안에 문자열 - 120908
2+
3+
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/120908)
4+
5+
### 성능 요약
6+
7+
메모리: 33.5 MB, 시간: 0.04 ms
8+
9+
### 구분
10+
11+
코딩테스트 연습 > 코딩테스트 입문
12+
13+
### 채점결과
14+
15+
정확성: 100.0<br/>합계: 100.0 / 100.0
16+
17+
### 제출 일자
18+
19+
2025년 05월 12일 22:14:26
20+
21+
### 문제 설명
22+
23+
<p>문자열 <code>str1</code>, <code>str2</code>가 매개변수로 주어집니다. <code>str1</code> 안에 <code>str2</code>가 있다면 1을 없다면 2를 return하도록 solution 함수를 완성해주세요.</p>
24+
25+
<hr>
26+
27+
<h5>제한사항</h5>
28+
29+
<ul>
30+
<li>1 ≤ <code>str1</code>의 길이 ≤ 100</li>
31+
<li>1 ≤ <code>str2</code>의 길이 ≤ 100</li>
32+
<li>문자열은 알파벳 대문자, 소문자, 숫자로 구성되어 있습니다.</li>
33+
</ul>
34+
35+
<hr>
36+
37+
<h5>입출력 예</h5>
38+
<table class="table">
39+
<thead><tr>
40+
<th>str1</th>
41+
<th>str2</th>
42+
<th>result</th>
43+
</tr>
44+
</thead>
45+
<tbody><tr>
46+
<td>"ab6CDE443fgh22iJKlmn1o"</td>
47+
<td>"6CD"</td>
48+
<td>1</td>
49+
</tr>
50+
<tr>
51+
<td>"ppprrrogrammers"</td>
52+
<td>"pppp"</td>
53+
<td>2</td>
54+
</tr>
55+
<tr>
56+
<td>"AbcAbcA"</td>
57+
<td>"AAA"</td>
58+
<td>2</td>
59+
</tr>
60+
</tbody>
61+
</table>
62+
<hr>
63+
64+
<h5>입출력 예 설명</h5>
65+
66+
<p>입출력 예 #1</p>
67+
68+
<ul>
69+
<li>"ab<code>6CD</code>E443fgh22iJKlmn1o" <code>str1</code>에 <code>str2</code>가 존재하므로 1을 return합니다.</li>
70+
</ul>
71+
72+
<p>입출력 예 #2</p>
73+
74+
<ul>
75+
<li>"ppprrrogrammers" <code>str1</code>에 <code>str2</code>가 없으므로 2를 return합니다.</li>
76+
</ul>
77+
78+
<p>입출력 예 #3</p>
79+
80+
<ul>
81+
<li>"AbcAbcA" <code>str1</code>에 <code>str2</code>가 없으므로 2를 return합니다.</li>
82+
</ul>
83+
84+
85+
> 출처: 프로그래머스 코딩 테스트 연습, https://school.programmers.co.kr/learn/challenges
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const solution = (str1, str2) => str1.includes(str2) ? 1 : 2

0 commit comments

Comments
 (0)