Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- bf16
- fine tuning
- 활성화 함수
- fp16
- LLaVA
- rrf
- Non-Maximum Suppression
- Time Series
- 딥러닝
- qlora
- Nested Learning
- 합성곱 신경망
- Cross Entropy Error
- Mean squared error
- pdf parsing
- visual instruction tuning
- rag-fusion
- fp32
- 오차역전파
- 데이터 파싱
- LLM
- anomaly detection
- rag parsing
- deep learning
- 활성화함수
- 파인튜닝
- multi-query
- LLM 패러다임
- gemma3
- 이상탐지
Archives
- Today
- Total
Attention, Please!!!
[LeetCode] Valid Sudoku 본문
문제

풀이
class Solution:
def isValidSudoku(self, board: List[List[str]]) -> bool:
rows = collections.defaultdict(set)
cols = collections.defaultdict(set)
squares = collections.defaultdict(set)
# 1. 9X9 Grid 만든다
for r in range(9):
for c in range(9):
# 2. "."와 같이 비어있는 값이 있는지 파악을 합니다. 이에 빈칸이라면, 계속해서 loop를 돌립니다.
if board[r][c] == ".":
continues
# 3. 중복되는 값이 있다면 loop를 종료 시킵니다.
if(board[r][c] in rows[r] or
board[r][c] in cols[c] or
board[r][c] in squares[(r//3),(c//3)]):
return False
rows[r].add(board[r][c])
cols[c].add(board[r][c])
squares[(r//3),(c//3).add(board[r][c])
return True
'Algorithm > Leetcode' 카테고리의 다른 글
| [LeetCode] Valid Anagram (0) | 2024.02.16 |
|---|---|
| [LeetCode] Product of Array Except Self (0) | 2023.12.14 |
| [LeetCode] SQL 50문제 (진행중) (0) | 2023.10.24 |
| [LeetCode] Two Sum (0) | 2023.10.20 |
| [LeetCode] Contains Duplicate (0) | 2023.10.10 |