| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- iterator
- 43. Multiply Strings
- 컴퓨터의 구조
- 파이썬
- Protocol
- shiba
- kaggle
- Substring with Concatenation of All Words
- data science
- 시바견
- Regular Expression
- t1
- concurrency
- Python Implementation
- 315. Count of Smaller Numbers After Self
- 715. Range Module
- Convert Sorted List to Binary Search Tree
- 프로그래머스
- Generator
- Python Code
- 30. Substring with Concatenation of All Words
- Python
- attribute
- 운영체제
- LeetCode
- 109. Convert Sorted List to Binary Search Tree
- 밴픽
- DWG
- Decorator
- Class
Archives
- Today
- Total
Scribbling
LeetCode: 1610. Maximum Number of Visible Points 본문
Computer Science/Coding Test
LeetCode: 1610. Maximum Number of Visible Points
focalpoint 2022. 3. 7. 14:29class Solution:
def visiblePoints(self, points: List[List[int]], angle: int, location: List[int]) -> int:
from math import atan2, pi
from bisect import bisect_right
numLoc = 0
angles = []
for point in points:
x, y = point[0] - location[0], point[1] - location[1]
if x == 0 and y == 0:
numLoc += 1
else:
val = atan2(y, x) * 180 / pi
if val < 0:
val += 360
angles.append(val)
angles.sort()
angles += [angle+360 for angle in angles]
ret = numLoc
for i in range(len(angles)//2):
j = bisect_right(angles, angles[i]+angle)
ret = max(ret, j - i + numLoc)
return ret'Computer Science > Coding Test' 카테고리의 다른 글
| LeetCode: 1834. Single-Threaded CPU (0) | 2022.03.08 |
|---|---|
| LeetCode: 407. Trapping Rain Water II (0) | 2022.03.08 |
| LeetCode: 1284. Minimum Number of Flips to Convert Binary Matrix to Zero Matrix (0) | 2022.03.04 |
| LeetCode: 715. Range Module (0) | 2022.03.03 |
| LeetCode: 1048. Longest String Chain (0) | 2022.02.27 |