Concept Flow - Buy and Sell Stocks All Variants
Start
Initialize variables: minPrice, maxProfit
Iterate over prices
Compare current price with minPrice
Calculate profit = current price - minPrice
Continue iteration
Return maxProfit
End
The flow shows how we track the lowest price and calculate the maximum profit by iterating through stock prices once.
