def get_max_profit1(stock_prices):
    """
    - Time: O(n^2)
    - Space: O(1)
    * n is len(stock_prices)
    """
    length = len(stock_prices)
    assert length > 1, 'Getting a profit requires at least 2 prices'

    profit = stock_prices[1] - stock_prices[0]
    length = len(stock_prices)

    for i in range(length):
        for j in range(i + 1, length):
            if stock_prices[j] - stock_prices[i] > profit:
                profit = stock_prices[j] - stock_prices[i]

    return profit