Search
Duplicate

카드 뭉치

Level
1
문제 진행 상태
코드 완료
해설 작성 중
알고리즘 & 자료구조
리스트
정답률 (%)
67
태그
연습문제

문제 링크

풀이 과정

전체 코드

def solution(cards1, cards2, goal): flag = True cards1_idx, cards2_idx, goal_idx = 0, 0, 0 cards1_len, cards2_len, goal_len = tuple( map(lambda x: len(x), [cards1, cards2, goal]) ) while goal_idx < goal_len: if (cards1_idx < cards1_len) and (goal[goal_idx] == cards1[cards1_idx]): cards1_idx += 1 goal_idx += 1 elif (cards2_idx < cards2_len) and (goal[goal_idx] == cards2[cards2_idx]): cards2_idx += 1 goal_idx += 1 else: flag = False break return "Yes" if flag else "No"
Python
복사