Trading secrets
CodeChefOpen on judge ↗
Anuj is a new trader and he wants to increase his profits in the stock market. He will be provided with an array, prices where prices[i] represents the price of a particular stock on the ith day. He will choose one day in this array to buy the stock and will choose another day when he will sell the stock. Help him maximize his profit. If he can’t get a profit in any of the day then display the pro
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