MARKET
CodeChefOpen on judge ↗
Chef has become so good at predicting the market that he already knows what the share price of the $abc$ company will be for the next $N$ days. Each day, Chef can either buy one share of $abc$, sell any number of shares of $abc$ that he owns, or not do anything at all. What is the $maximum$ profit Chef can obtain? ### Input - The first line contains an integer $N$. - The next line contains n spa
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start