def max_returns(prices):
    """
    Calculate maxiumum possible return in O(n) time complexity
    
    Args:
       prices(array): array of prices
    Returns:
       int: The maximum profit possible
    """
    if len(prices) < 2:
        return 0

    min_price_index = 0
    max_price_index = 0
    current_min_price_index = 0

    for i in range(1, len(prices)):
        # current minimum price
        if prices[i] < prices[current_min_price_index]:
            current_min_price_index = i
        # current max profit
        if prices[i] - prices[current_min_price_index] > prices[max_price_index] - prices[min_price_index]:
            max_price_index = i
            min_price_index = current_min_price_index
    max_profit = prices[max_price_index] - prices[min_price_index]
    return max_profit