일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- Generator
- 시바견
- attribute
- iterator
- Substring with Concatenation of All Words
- 컴퓨터의 구조
- Python
- shiba
- 109. Convert Sorted List to Binary Search Tree
- data science
- 715. Range Module
- Python Implementation
- Convert Sorted List to Binary Search Tree
- 운영체제
- 파이썬
- 315. Count of Smaller Numbers After Self
- 프로그래머스
- concurrency
- kaggle
- LeetCode
- 30. Substring with Concatenation of All Words
- DWG
- t1
- Decorator
- Regular Expression
- Python Code
- Protocol
- 43. Multiply Strings
- 밴픽
- Class
Archives
- Today
- Total
Scribbling
프로그래머스: 카펫 본문
x * y = brown + yellow
(x-2) * (y-2) = yellow
--> 모든 정수 조합 완전 탐색
def solution(brown, yellow):
answer = []
xy_product = brown + yellow
candidates = []
for i in range(1, xy_product//2+1):
if xy_product % i == 0:
candidates.append((xy_product//i, i))
for candidate in candidates:
if (candidate[0]-2) * (candidate[1]-2) == yellow:
return candidate
'Computer Science > Coding Test' 카테고리의 다른 글
LeetCode: 102. Binary Tree Level Order Traversal (0) | 2021.10.20 |
---|---|
프로그래머스: 모의고사 (0) | 2021.10.20 |
프로그래머스: 소수 찾기 (0) | 2021.10.19 |
프로그래머스: H-Index (0) | 2021.10.18 |
프로그래머스: 이중 우선 순위 큐 (0) | 2021.10.16 |