Back to problems

Portfolio Trading Optimizer (Multiple Transactions + Input Validation + Report)

Algorithm · Point72 · Medium

You are provided with an array of integers called prices, where prices[i] represents the value of a single stock on day i. Trading constraints: On any given day, you are allowed to buy, sell, or do both. You may own no more than one share at any moment. This means you cannot purchase additional stock until you have sold your current holding. You are permitted to execute multiple buy-sell cycles throughout the period. Objective: Determine the trading sequence that yields the…

Checking your access…