전체 글 343

자물쇠와 열쇠 ( Level 3, Python, 2020 Kakao Blind Recruitment )

def rotate(board): board = zip(*board[::-1]) return [list(b) for b in board] def solution(key, lock): n, m = len(key), len(lock) zero = sum(lock, []).count(0) lock = [[0] * 3 * m for _ in range(m)] +\ [[0] * m + lock[i] + [0] * m for i in range(m)] +\ [[0] * 3 * m for _ in range(m)] for _ in range(4): key = rotate(key) for i in range(3 * m - n): for j in range(3 * m - n): temp, count = 0, 0 for ..

반응형