| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 715. Range Module
- Python Implementation
- 밴픽
- 109. Convert Sorted List to Binary Search Tree
- 315. Count of Smaller Numbers After Self
- Python
- 30. Substring with Concatenation of All Words
- data science
- Python Code
- shiba
- 파이썬
- 프로그래머스
- 시바견
- LeetCode
- iterator
- kaggle
- concurrency
- Protocol
- Generator
- Class
- DWG
- t1
- attribute
- 43. Multiply Strings
- Substring with Concatenation of All Words
- Decorator
- Regular Expression
- 컴퓨터의 구조
- 운영체제
- Convert Sorted List to Binary Search Tree
Archives
- Today
- Total
Scribbling
36. Valid Sudoku 본문
class Solution:
def isValidSudoku(self, board: List[List[str]]) -> bool:
for i in range(9):
for j in range(9):
if board[i][j] != '.':
# 가로
for k in range(9):
if k == j:
continue
if board[i][j] == board[i][k]:
return False
# 세로
for k in range(9):
if k == i:
continue
if board[i][j] == board[k][j]:
return False
# 사각형
start_y = i // 3 * 3
start_x = j // 3 * 3
for y in range(start_y, start_y+3):
for x in range(start_x, start_x + 3):
if y == i or x == j:
continue
if board[i][j] == board[y][x]:
return False
return True'Computer Science > Coding Test' 카테고리의 다른 글
| LeetCode: 40. Combination Sum II (0) | 2021.09.07 |
|---|---|
| 37. Sudoku Solver (0) | 2021.09.06 |
| 44. Wildcard Matching (0) | 2021.09.06 |
| LeetCode: 48. Rotate Image (0) | 2021.09.05 |
| 39. Combination Sum (0) | 2021.09.04 |