← All problemsSign in

E - Mehuls Trading Algorithm

Mehul has joined the trading business. With help of inside information he was able to get his hands on an array of integers (prices), for which the i-th element is the price of a given stock on day i. He wants to earn a lot of money however is busy hosting a contest. So he has asked you to come up with an algorithm to help him buy and sell the stock at right times to maximize his profits. For ever

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start