Skip to content

Commit 629cd27

Browse files
chore: sync baekjoon archives
1 parent fc4e2a9 commit 629cd27

File tree

8 files changed

+343
-0
lines changed

8 files changed

+343
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# [level 0] n개 간격의 원소들 - 181888
2+
3+
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/181888)
4+
5+
### 성능 요약
6+
7+
메모리: 9.34 MB, 시간: 0.00 ms
8+
9+
### 구분
10+
11+
코딩테스트 연습 > 코딩 기초 트레이닝
12+
13+
### 채점결과
14+
15+
정확성: 100.0<br/>합계: 100.0 / 100.0
16+
17+
### 제출 일자
18+
19+
2026년 02월 16일 00:07:25
20+
21+
### 문제 설명
22+
23+
<p>정수 리스트 <code>num_list</code>와 정수 <code>n</code>이 주어질 때, <code>num_list</code>의 첫 번째 원소부터 마지막 원소까지 <code>n</code>개 간격으로 저장되어있는 원소들을 차례로 담은 리스트를 return하도록 solution 함수를 완성해주세요.</p>
24+
25+
<hr>
26+
27+
<h5>제한사항</h5>
28+
29+
<ul>
30+
<li>5 ≤ <code>num_list</code>의 길이 ≤ 20</li>
31+
<li>1 ≤ <code>num_list</code>의 원소 ≤ 9</li>
32+
<li>1 ≤ <code>n</code> ≤ 4</li>
33+
</ul>
34+
35+
<hr>
36+
37+
<h5>입출력 예</h5>
38+
<table class="table">
39+
<thead><tr>
40+
<th>num_list</th>
41+
<th>n</th>
42+
<th>result</th>
43+
</tr>
44+
</thead>
45+
<tbody><tr>
46+
<td>[4, 2, 6, 1, 7, 6]</td>
47+
<td>2</td>
48+
<td>[4, 6, 7]</td>
49+
</tr>
50+
<tr>
51+
<td>[4, 2, 6, 1, 7, 6]</td>
52+
<td>4</td>
53+
<td>[4, 7]</td>
54+
</tr>
55+
</tbody>
56+
</table>
57+
<hr>
58+
59+
<h5>입출력 예 설명</h5>
60+
61+
<p>입출력 예 #1</p>
62+
63+
<ul>
64+
<li>[4, 2, 6, 1, 7, 6]에서 2개 간격으로 저장되어 있는 원소들은 [4, 6, 7]입니다.</li>
65+
</ul>
66+
67+
<p>입출력 예 #2</p>
68+
69+
<ul>
70+
<li>[4, 2, 6, 1, 7, 6]에서 4개 간격으로 저장되어 있는 원소들은 [4, 7]입니다.</li>
71+
</ul>
72+
73+
74+
> 출처: 프로그래머스 코딩 테스트 연습, https://school.programmers.co.kr/learn/challenges
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def solution(num_list, n):
2+
answer = []
3+
answer=num_list[::n]
4+
return answer
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# [level 0] 카운트 업 - 181920
2+
3+
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/181920)
4+
5+
### 성능 요약
6+
7+
메모리: 9.24 MB, 시간: 0.01 ms
8+
9+
### 구분
10+
11+
코딩테스트 연습 > 코딩 기초 트레이닝
12+
13+
### 채점결과
14+
15+
정확성: 100.0<br/>합계: 100.0 / 100.0
16+
17+
### 제출 일자
18+
19+
2026년 02월 16일 00:06:25
20+
21+
### 문제 설명
22+
23+
<p>정수 <code>start_num</code>와 <code>end_num</code>가 주어질 때, <code>start_num</code>부터 <code>end_num</code>까지의 숫자를 차례로 담은 리스트를 return하도록 solution 함수를 완성해주세요.</p>
24+
25+
<hr>
26+
27+
<h5>제한사항</h5>
28+
29+
<ul>
30+
<li>0 ≤ <code>start_num</code> ≤ <code>end_num</code> ≤ 50</li>
31+
</ul>
32+
33+
<hr>
34+
35+
<h5>입출력 예</h5>
36+
<table class="table">
37+
<thead><tr>
38+
<th>start_num</th>
39+
<th>end_num</th>
40+
<th>result</th>
41+
</tr>
42+
</thead>
43+
<tbody><tr>
44+
<td>3</td>
45+
<td>10</td>
46+
<td>[3, 4, 5, 6, 7, 8, 9, 10]</td>
47+
</tr>
48+
</tbody>
49+
</table>
50+
<hr>
51+
52+
<h5>입출력 예 설명</h5>
53+
54+
<p>입출력 예 #1</p>
55+
56+
<ul>
57+
<li>3부터 10까지의 숫자들을 담은 리스트 [3, 4, 5, 6, 7, 8, 9, 10]를 return합니다.</li>
58+
</ul>
59+
60+
61+
> 출처: 프로그래머스 코딩 테스트 연습, https://school.programmers.co.kr/learn/challenges
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
def solution(start_num, end_num):
2+
answer = []
3+
for i in range(start_num, end_num+1):
4+
answer.append(i)
5+
return answer
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# [level 0] 첫 번째로 나오는 음수 - 181896
2+
3+
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/181896)
4+
5+
### 성능 요약
6+
7+
메모리: 81.6 MB, 시간: 0.03 ms
8+
9+
### 구분
10+
11+
코딩테스트 연습 > 코딩 기초 트레이닝
12+
13+
### 채점결과
14+
15+
정확성: 100.0<br/>합계: 100.0 / 100.0
16+
17+
### 제출 일자
18+
19+
2026년 02월 15일 23:42:06
20+
21+
### 문제 설명
22+
23+
<p>정수 리스트 <code>num_list</code>가 주어질 때, 첫 번째로 나오는 음수의 인덱스를 return하도록 solution 함수를 완성해주세요. 음수가 없다면 -1을 return합니다.</p>
24+
25+
<hr>
26+
27+
<h5>제한사항</h5>
28+
29+
<ul>
30+
<li>5 ≤ <code>num_list</code>의 길이 ≤ 100</li>
31+
<li>-10 ≤ <code>num_list</code>의 원소 ≤ 100</li>
32+
</ul>
33+
34+
<hr>
35+
36+
<h5>입출력 예</h5>
37+
<table class="table">
38+
<thead><tr>
39+
<th>num_list</th>
40+
<th>result</th>
41+
</tr>
42+
</thead>
43+
<tbody><tr>
44+
<td>[12, 4, 15, 46, 38, -2, 15]</td>
45+
<td>5</td>
46+
</tr>
47+
<tr>
48+
<td>[13, 22, 53, 24, 15, 6]</td>
49+
<td>-1</td>
50+
</tr>
51+
</tbody>
52+
</table>
53+
<hr>
54+
55+
<h5>입출력 예 설명</h5>
56+
57+
<p>입출력 예 #1</p>
58+
59+
<ul>
60+
<li>5번 인덱스에서 음수가 처음 등장하므로 5를 return합니다.</li>
61+
</ul>
62+
63+
<p>입출력 예 #2</p>
64+
65+
<ul>
66+
<li>음수가 없으므로 -1을 return합니다.</li>
67+
</ul>
68+
69+
70+
> 출처: 프로그래머스 코딩 테스트 연습, https://school.programmers.co.kr/learn/challenges
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
class Solution {
2+
public int solution(int[] num_list) {
3+
// num_list를 순회하면서 음수 찾기
4+
for (int i=0; i<num_list.length; i++) {
5+
// 현재 숫자가 0보다 작으면 (음수이면)
6+
// 해당 인덱스를 바로 반환
7+
if (num_list[i] < 0) {
8+
return i;
9+
}
10+
}
11+
12+
// 음수를 찾지 못한 경우 -1 반환
13+
return -1;
14+
}
15+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# [level 0] 조건 문자열 - 181934
2+
3+
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/181934)
4+
5+
### 성능 요약
6+
7+
메모리: 73.5 MB, 시간: 0.02 ms
8+
9+
### 구분
10+
11+
코딩테스트 연습 > 코딩 기초 트레이닝
12+
13+
### 채점결과
14+
15+
정확성: 100.0<br/>합계: 100.0 / 100.0
16+
17+
### 제출 일자
18+
19+
2026년 02월 15일 23:41:38
20+
21+
### 문제 설명
22+
23+
<p>문자열에 따라 다음과 같이 두 수의 크기를 비교하려고 합니다. </p>
24+
25+
<ul>
26+
<li>두 수가 <code>n</code>과 <code>m</code>이라면
27+
28+
<ul>
29+
<li>"&gt;", "=" : <code>n</code> &gt;= <code>m</code></li>
30+
<li>"&lt;", "=" : <code>n</code> &lt;= <code>m</code></li>
31+
<li>"&gt;", "!" : <code>n</code> &gt; <code>m</code></li>
32+
<li>"&lt;", "!" : <code>n</code> &lt; <code>m</code> </li>
33+
</ul></li>
34+
</ul>
35+
36+
<p>두 문자열 <code>ineq</code>와 <code>eq</code>가 주어집니다. <code>ineq</code>는 "&lt;"와 "&gt;"중 하나고, <code>eq</code>는 "="와 "!"중 하나입니다. 그리고 두 정수 <code>n</code>과 <code>m</code>이 주어질 때, <code>n</code>과 <code>m</code>이 <code>ineq</code>와 <code>eq</code>의 조건에 맞으면 1을 아니면 0을 return하도록 solution 함수를 완성해주세요.</p>
37+
38+
<hr>
39+
40+
<h5>제한 사항</h5>
41+
42+
<ul>
43+
<li>1 ≤ <code>n</code>, <code>m</code> ≤ 100</li>
44+
</ul>
45+
46+
<hr>
47+
48+
<h5>입출력 예</h5>
49+
<table class="table">
50+
<thead><tr>
51+
<th>ineq</th>
52+
<th>eq</th>
53+
<th>n</th>
54+
<th>m</th>
55+
<th>result</th>
56+
</tr>
57+
</thead>
58+
<tbody><tr>
59+
<td>"&lt;"</td>
60+
<td>"="</td>
61+
<td>20</td>
62+
<td>50</td>
63+
<td>1</td>
64+
</tr>
65+
<tr>
66+
<td>"&gt;"</td>
67+
<td>"!"</td>
68+
<td>41</td>
69+
<td>78</td>
70+
<td>0</td>
71+
</tr>
72+
</tbody>
73+
</table>
74+
<hr>
75+
76+
<h5>입출력 예 설명</h5>
77+
78+
<p>입출력 예 #1</p>
79+
80+
<ul>
81+
<li>20 &lt;= 50은 참이기 때문에 1을 return합니다.</li>
82+
</ul>
83+
84+
<p>입출력 예 #2</p>
85+
86+
<ul>
87+
<li>41 &gt; 78은 거짓이기 때문에 0을 return합니다.</li>
88+
</ul>
89+
90+
<hr>
91+
92+
<p>※ 2023.05.31 테스트 케이스가 수정되었습니다. 기존에 제출한 코드가 통과하지 못할 수도 있습니다.</p>
93+
94+
95+
> 출처: 프로그래머스 코딩 테스트 연습, https://school.programmers.co.kr/learn/challenges
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Solution {
2+
public int solution(String ineq, String eq, int n, int m) {
3+
if (ineq.equals(">")) {
4+
if (eq.equals("=")) {
5+
return n >= m ? 1 : 0;
6+
} else if (eq.equals("!")) {
7+
return n > m ? 1 : 0;
8+
}
9+
} else if (ineq.equals("<")) {
10+
if (eq.equals("=")) {
11+
return n <= m ? 1 : 0;
12+
} else if (eq.equals("!")) {
13+
return n < m ? 1 : 0;
14+
}
15+
}
16+
17+
return 0; // 기본적으로 0을 반환 (조건에 맞지 않는 경우)
18+
}
19+
}

0 commit comments

Comments
 (0)