Concept Flow - Buy and Sell Stocks All Variants
Start with price array
Choose variant: single, multiple, cooldown, fee
Initialize variables: buy, sell, cooldown, fee
Iterate over prices
Update buy/sell states based on rules
Track max profit
End iteration
Return max profit
The flow starts with the price list, selects the variant rule, iterates over prices updating buy/sell states, and finally returns the max profit.