| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- iterator
- Class
- Python Code
- Convert Sorted List to Binary Search Tree
- Regular Expression
- Substring with Concatenation of All Words
- Python Implementation
- 시바견
- concurrency
- 컴퓨터의 구조
- Decorator
- kaggle
- 30. Substring with Concatenation of All Words
- t1
- attribute
- Generator
- data science
- 43. Multiply Strings
- DWG
- 운영체제
- 109. Convert Sorted List to Binary Search Tree
- 315. Count of Smaller Numbers After Self
- LeetCode
- 프로그래머스
- shiba
- 715. Range Module
- Protocol
- 파이썬
- 밴픽
- Python
Archives
- Today
- Total
Scribbling
LeetCode: 122. Best Time to Buy and Sell Stock II 본문
Computer Science/Coding Test
LeetCode: 122. Best Time to Buy and Sell Stock II
focalpoint 2021. 11. 3. 20:20class Solution:
def maxProfit(self, prices: List[int]) -> int:
profit, prev = 0, prices[0]
for i in range(1, len(prices)):
if prices[i] >= prev:
profit += prices[i] - prev
prev = prices[i]
return profit'Computer Science > Coding Test' 카테고리의 다른 글
| LeetCode: 188. Best Time to Buy and Sell Stock IV (0) | 2021.11.04 |
|---|---|
| LeetCode: 123. Best Time to Buy and Sell Stock III (0) | 2021.11.03 |
| LeetCode: 120. Triangle (0) | 2021.11.03 |
| LeetCode: 117. Populating Next Right Pointers in Each Node II (0) | 2021.11.03 |
| 프로그래머스: 징검다리 (0) | 2021.11.03 |