문제
https://school.programmers.co.kr/learn/courses/30/lessons/133502#
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
코드

def solution(ingredient):
answer = 0
ingredient = ''.join(map(str,ingredient))
while 1:
h = ingredient.count('1231')
if h >= 1:
answer += h
ingredient = ingredient.replace('1231','',h)
else:
break
return answer

'⏳ 알고리즘 > python 알고리즘 문제 풀이' 카테고리의 다른 글
프로그래머스 - LV2. 택배상자 (0) | 2022.11.04 |
---|---|
프로그래머스 - LV2. 롤케이크 자르기 (0) | 2022.11.04 |
프로그래머스 - LV3. 가장 먼 노드 (0) | 2022.10.27 |
프로그래머스 - LV3. 순위 (0) | 2022.10.27 |
프로그래머스 - LV2. 연속 부분 수열 (0) | 2022.10.21 |