일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- 미드시청
- English
- 파비최
- 영어원서읽기
- Daily Challenge
- 링피트
- leetcode
- 사이드
- 스탭퍼
- 뭐든
- 운동
- 10분
- 30분
- realclass
- FIT XR
- 프로젝트
- 매일
- 화상영어
- 3줄정리
- 개발자
- 월간
- 영어공부
- 리얼 클래스
- Problem Solving
- 만화도
- 잡생각
- 괜찮음
- Writing
- 읽기
- 쓰릴오브파이트
Archives
- Today
- Total
파비의 매일매일 공부기록
2023.06.19 Today's Challenge 본문
https://leetcode.com/problems/find-the-highest-altitude/
Find the Highest Altitude - LeetCode
Can you solve this real interview question? Find the Highest Altitude - There is a biker going on a road trip. The road trip consists of n + 1 points at different altitudes. The biker starts his trip on point 0 with altitude equal 0. You are given an integ
leetcode.com
오랫만에 매우 쉬운 문제가 나왔음.
class Solution:
def largestAltitude(self, gain: List[int]) -> int:
h = 0
res = h
if len(gain) == 1:
return h if h > gain[0] else gain[0]
for g in gain:
h += g
res = max(res, h)
return res
반응형
'Problem Solving > LeetCode' 카테고리의 다른 글
2023.06.21 Today's Challenge (0) | 2023.06.21 |
---|---|
2023.06.20 Today's Challenge (0) | 2023.06.20 |
2023.06.18 Today's Challenge (0) | 2023.06.18 |
2023.06.17 Today's Challenge (0) | 2023.06.17 |
2023.06.16 Today's Challenge (0) | 2023.06.16 |
Comments