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 |
Tags
- 활성화 함수
- rag parsing
- LLM 패러다임
- deep learning
- gemma3
- LLaVA
- rag-fusion
- 합성곱 신경망
- 오차역전파
- 이상탐지
- pdf parsing
- bf16
- visual instruction tuning
- fp32
- Nested Learning
- Cross Entropy Error
- fine tuning
- rrf
- Time Series
- qlora
- multi-query
- 활성화함수
- 파인튜닝
- anomaly detection
- Mean squared error
- 데이터 파싱
- fp16
- LLM
- Non-Maximum Suppression
- 딥러닝
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 |