https://school.programmers.co.kr/learn/courses/30/lessons/133502
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
def solution(ingredient):
# 1: 빵, 2: 야채, 3: 고기
# 1 - 2 - 3 - 1
burger = []
answer = 0
for i in ingredient:
burger.append(i)
if burger[-4:] == [1, 2, 3, 1]:
answer += 1
for _ in range(4):
burger.pop()
return answer
'알고리즘' 카테고리의 다른 글
[프로그래머스 / Python] 개인정보 수집 유효기간 (0) | 2023.06.24 |
---|---|
[BOJ / Python] 14719 빗물 (0) | 2023.06.20 |
[프로그래머스 / Python] 예산 (0) | 2023.06.17 |
[프로그래머스 / Python] 추억 점수 (0) | 2023.06.13 |
[프로그래머스 / Python] 대충만든자판 (0) | 2023.06.10 |