From 32426ebe5229fd97a8e92adb3a0e1e63156f107d Mon Sep 17 00:00:00 2001 From: Jisan <149364697+kjs254@users.noreply.github.com> Date: Thu, 11 Apr 2024 16:07:22 +0900 Subject: [PATCH] 2024-04-11 --- kjs254/README.md | 3 +++ ...\210\354\240\204\354\247\200\353\214\200.py" | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 "kjs254/\352\265\254\355\230\204/\354\225\210\354\240\204\354\247\200\353\214\200.py" diff --git a/kjs254/README.md b/kjs254/README.md index 09d98ff..9b7ff4c 100644 --- a/kjs254/README.md +++ b/kjs254/README.md @@ -11,4 +11,7 @@ | 7차시 | 2024.03.01 | 구현 | [캐시](https://school.programmers.co.kr/learn/courses/30/lessons/17680) | [#24](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/24) | | 8차시 | 2024.03.08 | 구현 | [튜플](https://school.programmers.co.kr/learn/courses/30/lessons/64065) | [#30](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/30) | | 9차시 | 2024.03.10 | 구현 | [뉴스 클러스터링](https://school.programmers.co.kr/learn/courses/30/lessons/17677) | [#33](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/33) | +| 10차시 | 2024.04.02 | 해시 | [전화번호 목록](https://school.programmers.co.kr/learn/courses/30/lessons/42577) | [#46](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/46) | +| 11차시 | 2024.04.05 | DFS | [타겟 넘버](https://school.programmers.co.kr/learn/courses/30/lessons/43165) | [#47](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/47) | +| 12차시 | 2024.04.11 | DFS | [안전지대](https://school.programmers.co.kr/learn/courses/30/lessons/120866) | [#50](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/50) | --- \ No newline at end of file diff --git "a/kjs254/\352\265\254\355\230\204/\354\225\210\354\240\204\354\247\200\353\214\200.py" "b/kjs254/\352\265\254\355\230\204/\354\225\210\354\240\204\354\247\200\353\214\200.py" new file mode 100644 index 0000000..75cc5d8 --- /dev/null +++ "b/kjs254/\352\265\254\355\230\204/\354\225\210\354\240\204\354\247\200\353\214\200.py" @@ -0,0 +1,17 @@ +def solution(board): + n = len(board) + for i in range(n): + board[i].insert(0,-1) + board[i].append(-1) + board.insert(0,[-1]*(n+2)) + board.append([-1]*(n+2)) + + for i in range(n+2): + for j in range(n+2): + + if board[i][j]==1: + for dx in (-1,0,1): + for dy in (-1,0,1): + board[i+dy][j+dx] = board[i+dy][j+dx]*2 -1 + + return sum(board, []).count(0) \ No newline at end of file