https://school.programmers.co.kr/learn/courses/30/lessons/64061
function solution(board, moves) {
var answer = 0;
let arr= [];
for(let i=0; i<moves.length; i++){
for(let j=0; j<board.length; j++){
if(board[j][moves[i]-1] !== 0){//1.
arr.push(board[j][moves[i]-1]);//2.
board[j][moves[i]-1]=0;//3.
if(arr.at(-1) === arr.at(-2)){//4.
arr.splice(-2, 2);//5.
answer+=2;//6.
}
break;//7.
}
}
}
return answer;
}