We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e4a9f4c commit 6b9801cCopy full SHA for 6b9801c
1 file changed
live10/test102/문제2/백한결.py
@@ -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