| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- 미드시청
- 개발자
- Daily Challenge
- Writing
- 링피트
- 만화도
- Problem Solving
- 쓰릴오브파이트
- 읽기
- English
- 영어원서읽기
- 프로젝트
- 리얼 클래스
- FIT XR
- 화상영어
- leetcode
- 3줄정리
- 뭐든
- 파비최
- 괜찮음
- 30분
- 사이드
- 스탭퍼
- 10분
- 매일
- 운동
- 영어공부
- 잡생각
- 월간
- realclass
Archives
- Today
- Total
파비의 매일매일 공부기록
2023.12.03 Today's Challenge 본문
https://leetcode.com/problems/minimum-time-visiting-all-points/
Minimum Time Visiting All Points - LeetCode
Can you solve this real interview question? Minimum Time Visiting All Points - On a 2D plane, there are n points with integer coordinates points[i] = [xi, yi]. Return the minimum time in seconds to visit all the points in the order given by points. You can
leetcode.com
쉬운 문제긴 했음
class Solution:
def minTimeToVisitAllPoints(self, points: List[List[int]]) -> int:
ans = 0
for i in range(len(points) - 1):
curr_x, curr_y = points[i]
target_x, target_y = points[i+1]
ans += max(abs(target_x - curr_x), abs(target_y - curr_y))
return ans반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
| 2023.12.05 Today's Challenge (0) | 2023.12.05 |
|---|---|
| 2023.12.04 Today's Challenge (1) | 2023.12.04 |
| 2023.12.02 Today's Challenge (1) | 2023.12.02 |
| 2023.12.01 Today's Challenge (0) | 2023.12.01 |
| 2023.11.30 Today's Challenge (0) | 2023.11.30 |
Comments