Skip to content

Commit

Permalink
저장#7
Browse files Browse the repository at this point in the history
  • Loading branch information
22sonamu authored and 22sonamu committed Dec 23, 2022
1 parent d78a02b commit 1f72864
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions 마라/7주차/11003_최솟값찾기.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from collections import deque

N, L = map(int, input().split())
lst = map(int, input().split())

q = deque()

m = 1000000000

m2 = 1000000000

answerlst = []

for item in lst :
q.append(item)
#큐에 L 길이 이상 원소가 들어갈 경우
if len(q) > L :
if q[0] == m :
m = m2
q.popleft()


if item <= m :
m = item
else :
if item > m and item <= m2 :
m2 = item

answerlst.append(m)


print(answerlst)


0 comments on commit 1f72864

Please sign in to comment.