카드 뭉치

NJW·2023년 6월 3일
0

코테

목록 보기
167/170
def solution(cards1, cards2, goal):
    answer = "Yes"
    idx1 = 0
    idx2 = 0
    
    for g in goal:
        if idx1 < len(cards1) and g == cards1[idx1]:
            idx1 += 1
        elif idx2 < len(cards2) and g == cards2[idx2]:
            idx2 += 1
        else:
            answer = "No"
            break
    
    return answer

더 자세한 설명은 내 티스토리에

https://jiwonna52.tistory.com/18

profile
https://jiwonna52.tistory.com/

0개의 댓글