cf/mirror

Best Time to Buy and Sell Stock

CF
2156E2500· grandmaster4s256 MB⌨ stdin/stdout

Examples

Sample 1of 1multi-test • hover to link
Input
6
5
5 1 2 3 4
4
3 1 2 1
10
7 1 3 5 8 2 8 3 5 1
6
1 1 4 5 1 4
9
9 9 8 2 4 4 3 5 3
4
1000000000 1 2 3
Output
1
-2
5
3
1
-999999998
2156E.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…