
✅ 코드
1. 풀이
def solution(board, moves):
    answer = []
    count = 0
    for i in moves:
        for j in board:
            if answer[-1:] == [j[i-1]]:
                j[i-1] = 0
                del answer[-1:]
                count += 2
                break
            elif j[i-1] > 0:
                answer.append(j[i-1])
                j[i-1] = 0
                break
    return count
2. 다른 사람의 코드
def solution(board, moves):
    stacklist = []
    answer = 0
    for i in moves:
        for j in range(len(board)):
            if board[j][i-1] != 0:
                stacklist.append(board[j][i-1])
                board[j][i-1] = 0
                if len(stacklist) > 1:
                    if stacklist[-1] == stacklist[-2]:
                        stacklist.pop(-1)
                        stacklist.pop(-1)
                        answer += 2     
                break
    return answer
☑️ 핵심 코드
1. del
2. append(), pop()