[Programmers/Level 1] 크레인 인형뽑기 게임
from collections import deque def solution(board, moves): arr = [] answer = 0 board = deque(board) moves = deque(moves) while(len(moves)>0): go = moves.popleft() for i in range(len(board)): if(board[i][go-1] != 0): arr.append(board[i][go-1]) board[i][go-1] = 0 break try: if(arr[-1] == arr[-2]): del(arr[-1], arr[-1]) answer += 2 except: continue return answer 채점 결과 정확성: 100.0 합계: 100.0 / 100.0
2020. 6. 14. 19:31