Jim likes Pokemon and plays every game they appear in. The game he plays now is a trading game. Jim already knows the price of a Pokemon on each of the next n days. The type does not matter, so a single price applies to every Pokemon on a given day.
Jim starts with a fixed amount of money. He picks one day and spends all of his money buying Pokemon on that day, then picks a later day and sells all of them. Fractional Pokemon can be bought. The selling day must come after the buying day.
Find the largest profit Jim can get. If every choice loses money, find the smallest loss.