728x90
반응형
SMALL
def solution(board):
    answer = []
    
    for i in board:
        answer.append(list(i))
        
    
    for i, r in enumerate(board):
        for j, v in enumerate(r):
            if v==1:
                for q in range(i-1,i+2):
                    for r in range(j-1,j+2):                        
                        if 0<=q and q <len(board) and 0<=r and r < len(board[0]):
                            answer[q][r] = 1
    
    answer = len(board) * len(board[0]) - sum(list(map(sum,answer)))
    
    return answer
728x90
반응형
LIST

+ Recent posts