크레인 인형뽑기 게임

웹 개발자(백엔드)·2021년 9월 15일
0

프로그래머스

목록 보기
2/4

내가 작성한 코드

def solution(board, moves):
    answer = 0
    stack=[]
    maxx=max(moves)
    for x in moves:
        for i in range(maxx):
            if(board[i][x-1]!=0):
                stack.append((board[i][x-1])
                board[i][x-1]=0
                if len(stack)>=2 and stack[-1]==stack[-2]:
                    answer+=1
                    stack.pop()
                    stack.pop()
                break
    return answer

근데 다음과 같이 오류가 난다.

Traceback (most recent call last):
  File "/solution_test.py", line 6, in <module>
    from solution import *
  File "/solution.py", line 11
    board[i][x-1]=0
    ^
SyntaxError: invalid syntax
테스트 결과 (~˘▾˘)~

0개의 댓글