Skip to content

Commit 6b9801c

Browse files
author
hangyeol
committed
102차 2번 문제풀이
1 parent e4a9f4c commit 6b9801c

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
def main():
2+
N = int(input())
3+
a = list(map(int, input().strip().split()))[:N]
4+
5+
min_price = float('inf')
6+
max_profit = 0
7+
8+
for i in a:
9+
if i < min_price:
10+
min_price = i
11+
profit = i - min_price
12+
if profit > max_profit:
13+
max_profit = profit
14+
15+
print(max_profit)
16+
17+
18+
19+
if __name__ == "__main__":
20+
main()

0 commit comments

Comments
 (0)