프로그래머스 - 카드 뭉치
문제집 링크 : http://aladin.kr/p/szPra
프로그래머스 URL :
■ 작성 코드
def solution(cards1, cards2, goal):
answer = "Yes"
idx1, idx2 = 0, 0
for w in goal:
if idx1<len(cards1) and w == cards1[idx1]:
idx1 +=1
elif idx2<len(cards2) and w == cards2[idx2]:
idx2 +=1
else:
answer = "No"
break
return answer
반응형
'Programming Test > 문제풀이' 카테고리의 다른 글
[프로그래머스] 16. 잘라서 배열로 저장하기 - Python (0) | 2025.01.23 |
---|---|
[프로그래머스] 15. 로또의 최고 순위와 최저 순위 - Python (0) | 2025.01.22 |
[프로그래머스] 13. 369 게임 - Python (0) | 2025.01.21 |
[프로그래머스] 12. 치킨 쿠폰 - Python (0) | 2025.01.20 |
[프로그래머스] 11. 연속된 수의 합 - Python (0) | 2025.01.19 |