https://programmers.co.kr/learn/courses/30/lessons/64061?language=python3
def solution(board, moves):
answer = 0
basket = []
siz = len(board[0])
li = [0 for i in range(siz)]
for i in range(siz):
for j in range(siz):
if(li[j]==0 and board[i][j] !=0):
li[j] = siz-i
for i in moves:
num = i-1
if(li[num] == 0):
continue
dull = board[(siz-li[num])][num]
li[num] = li[num] - 1
if(len(basket)==0):
basket.append(dull)
else:
if(basket[-1]==dull):
basket.pop()
answer = answer +2
else:
basket.append(dull)
return answer
'IT > 알고리즘' 카테고리의 다른 글
[1day 1 solve , 20/07/07] 프로그래머스 크레인 인형 뽑기 lv2 (0) | 2020.07.07 |
---|---|
[프로그래머스/lv1]비밀지도/c++ (0) | 2020.01.27 |
[프로그래머스/lv1]나누어 떨어지는 숫자 배열/c++ (0) | 2020.01.25 |
[프로그래머스/lv1]가운데 글자/c++ (0) | 2020.01.25 |
[프로그래머스/lv1]체육복/c++ (0) | 2020.01.25 |