Get the highest profit by buying and selling stock once.
Asked in the tech screen stage. 2019 EM tech screen.
Given prices, where prices[i] is a stock price on day i, return the maximum profit achievable by buying on one day and selling on a later day. Return 0 if no profitable transaction exists.
prices is a list of integers. Return an integer representing the maximum profit.
def max_profit(prices):