def maxProfit(self, prices):
        if len(prices) <= 1:
            return 0

        # O(n) using dp
        forward = [0 for _ in xrange(len(prices))]  # forward[i] for 0..i
        lowest_buy_price = prices[0]
        for i in xrange(1, len(prices)):
            # if i==0:
            # forward[i] = 0
            # else:
            forward[i] = max(forward[i-1], prices[i]-lowest_buy_price)

            lowest_buy_price = min(prices[i], lowest_buy_price)

        backward = [0 for _ in xrange(len(prices))]  # backward[i] for i..len-1
        highest_sell_price = prices[-1]
        for i in xrange(len(prices)-2, -1, -1):
            # if i==len(prices)-1:
            # backward[i] = 0
            # else:
            backward[i] = max(backward[i+1], highest_sell_price-prices[i])

            highest_sell_price = max(prices[i], highest_sell_price)

        max_profit = 0
        for i in xrange(len(prices)):
            max_profit = max(max_profit, forward[i]+backward[i])
        return max_profit
The os_ver property.
dataset/ETHPy150Open algorhythms/LeetCode/123 Best Time to Buy and Sell Stock III.py/Solution.maxProfit--crossover with--dataset/ETHPy150Open Microsoft/ApplicationInsights-Python/applicationinsights/channel/contracts/Envelope.py/Envelope.os_ver