Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- csv x range
- LaTeX figure
- Resolution Changing
- Leetcode 70
- 프로그래머스 구명보트
- latex 첨자
- 걸쳐서 그림 넣기
- vim 찾아 바꾸기
- gnuplot csv
- vim 괄호 비활성화
- 프로그래머스 실패율
- without nohup.out
- git commit message
- vi/vim commands
- apt autoremove
- 프로그래머스 체육복
- Leetcode 121
- Climbing Stairs
- vi/vim 명령어
- vim set noshowmatch
- vim 치환
- python3
- linux prompt color
- apt clean
- 프로그래머스
- linux bash
- url reference
- VirtualBox
- Python Imaging Library
- tensorflow model load
Archives
- Today
- Total
기억노트
[Leetcode/Python3] 121. Best Time to Buy and Sell Stock 본문
Coding Test 준비/Leetcode
[Leetcode/Python3] 121. Best Time to Buy and Sell Stock
진바니 2022. 1. 11. 02:58Code
class Solution:
def maxProfit(self, prices: List[int]) -> int:
minv = prices[0]
res = 0
for x in prices[1:]:
minv = min(minv, x)
res = max(x - minv, res)
return res
Result
Runtime: 1088 ms
Memory Usage: 25.2 MB
'Coding Test 준비 > Leetcode' 카테고리의 다른 글
[Leetcode/Python3] 70. Climbing Stairs (0) | 2022.01.11 |
---|