[문제링크]
https://school.programmers.co.kr/learn/courses/30/lessons/133502
[github 링크]
from collections import deque
def solution(ingredient):
ingredient = deque(ingredient)
burger = []
answer = 0
while ingredient:
burger.append(ingredient.popleft())
if burger[-4:] == [1,2,3,1]:
burger = burger[:-4]
answer+=1
return answer
from collections import deque
def solution(ingredient):
ingredient = deque(ingredient)
burger = []
answer = 0
while ingredient:
burger.append(ingredient.popleft())
if burger[-4:] == [1,2,3,1]:
for _ in range(4):
burger.pop()
answer+=1
return answer
def solution(ingredient):
burger = []
answer = 0
for i in ingredient:
answer.append(i)
if burger[-4:] == [1, 2, 3, 1]:
answer += 1
for _ in range(4):
burger.pop()
return answer