Maximum Profit
CodeChefOpen on judge ↗
You have $d$ share of codechef. You know the price of this stock for next $n$ days. You want to sell all $d$ stocks in next $n$ days. On each day you can sell atmost $1$ stock. Since you know the price of stock you want to maximize your Profit. Print the maximum profit you can get by selling $d$ stocks in next $n$ days with at most $1$ stock on every day. ###Input: - Fist line
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