일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Regular Expression
- 운영체제
- LeetCode
- 715. Range Module
- t1
- Generator
- Decorator
- Convert Sorted List to Binary Search Tree
- 밴픽
- Python
- Substring with Concatenation of All Words
- 315. Count of Smaller Numbers After Self
- Protocol
- shiba
- Class
- 파이썬
- 컴퓨터의 구조
- Python Code
- kaggle
- 109. Convert Sorted List to Binary Search Tree
- 43. Multiply Strings
- 프로그래머스
- DWG
- 시바견
- attribute
- data science
- 30. Substring with Concatenation of All Words
- iterator
- concurrency
- Python Implementation
Archives
- Today
- Total
목록52. N-Queens II (1)
Scribbling
LeetCode: 52. N-Queens II
class Solution: def totalNQueens(self, n: int) -> int: self.ret = 0 self.solver(n, [], [], []) return self.ret def solver(self, n, queens, sumyx, subyx): if len(queens) == n: self.ret += 1 return for i in range(n): y, x = len(queens), i if (i not in queens) and ((y+x) not in sumyx) and ((y-x) not in subyx): self.solver(n, queens+[i], sumyx+[(y+x)], subyx+[(y-x)])
Computer Science/Coding Test
2021. 9. 15. 20:56