Stock Profit
CodeChefOpen on judge ↗
Say you have an array for which the i-th element is the price of a given stock on day $i$. Design an algorithm to find the maximum *profit*. You may complete at most $k$ transactions. Note: - You may not engage in *multiple transactions* at the same time (i.e, you must sell the stock before you buy again). - Buying and selling stocks are considered as two different transactions. ###Input Format
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