Skip to content

Commit 913f289

Browse files
committed
102차 2번 문제풀이
1 parent b34a827 commit 913f289

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import sys
2+
3+
input = sys.stdin.readline
4+
5+
n = int(input())
6+
arr = list(map(int, input().split()))
7+
8+
max_profit = 0
9+
min_price = float('inf')
10+
11+
for a in arr:
12+
min_price = min(a, min_price)
13+
max_profit = max(a - min_price, max_profit)
14+
15+
print(max_profit)

0 commit comments

Comments
 (0)