Skip to content

Commit

Permalink
32-alstjr7437 (#231)
Browse files Browse the repository at this point in the history
* 32차시 문제 선정

* 32차시 문제 solved
  • Loading branch information
alstjr7437 authored Aug 19, 2024
1 parent e6f1e10 commit efeee08
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion alstjr7437/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@
| 28차시 | 2024.05.30 | 브루트 포스 | <a href="https://www.acmicpc.net/problem/6064">카잉 달력</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/203 |
| 29차시 | 2024.06.11 | 이분 탐색 | <a href="https://www.acmicpc.net/problem/2805">나무 자르기</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/210 |
| 30차시 | 2024.06.19 | 방 번호 | <a href="https://www.acmicpc.net/problem/1475">구현</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/211 |
| 31차시 | 2024.06.19 | 게임 맵 최단거리 | <a href="https://school.programmers.co.kr/learn/courses/30/lessons/1844">BFS</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/218 |
| 31차시 | 2024.06.19 | 게임 맵 최단거리 | <a href="https://school.programmers.co.kr/learn/courses/30/lessons/1844">BFS</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/218 |
| 32차시 | 2024.08.15 | 과일 탕후루 | <a href="https://www.acmicpc.net/problem/30804">투 포인터</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-1/pull/230 |
22 changes: 22 additions & 0 deletions alstjr7437/투포인터/과일탕후루.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
N = int(input())
tanghuru = list(map(int, input().split()))
fruit = [0] * 10
kind = 0
start, end = 0, 0

while True:
if end == N:
print(end - start)
break
if fruit[tanghuru[end]] == 0:
kind += 1
fruit[tanghuru[end]] += 1
end += 1

if kind > 2:
fruit[tanghuru[start]] -= 1
if fruit[tanghuru[start]] == 0:
kind -= 1
start += 1


0 comments on commit efeee08

Please sign in to comment.