[프로그래머스] 크레인 인형뽑기 게임
코딩테스트 2022. 8. 21. 14:39

// https://school.programmers.co.kr/learn/courses/30/lessons/64061 function solution(board, moves) { const bucket = []; let result = 0; // board 인덱스별 board의 가로 위에서 아래로 // moves 배열 각 원소들의 값은 board의 index이며 해당하는 위치에 가장 위에 있는 인형을 가지고온다 for (const move of moves){ for(let i=0; i= 2){ // 새로 추가된것과 이전값을 비교해 동일하면 제거 후 result값 증가 if(bucket[bucket.length-1] === bucket[bucket.length-2]){ bucket.splice(bucke..