[Programmers] (Javascript) ํฌ๋ ์ธ ์ธํ๋ฝ๊ธฐ
ยท
๐ฏ CodingTest/Programmers
function solution(board, moves) { var answer = 0; var result = []; for(const e of moves) { var floor = e - 1; for(var i =0; i< board.length; i++) { var data = board[i][floor]; if (data !== 0) { if (result.length === 0) { result.push(data); } else { var trg = result.pop(); if (trg === data) { answer += 2 } else { result.push(trg); result.push(data); } } board[i][floor] = 0; break } } } return ans..