3652. Best Time to Buy and Sell Stock using Strategy
You are given two integer arrays prices and strategy, where: - prices[i] is the price of a given stock on the ith day. - strategy[i] represents a trading action on the ith day, where: - -1 indicates buying one unit of the stock. - 0 indicates holding the stock. - 1 indicates selling one unit of the stock. You are also given an even integer k, and may perform at most one modification to st
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