Write a Python algorithm that can calculate the highest possible profit from trading Bitcoin over a given period.
Write a function that can determine the maximum possible profit by buying and selling Bitcoin exactly once. You are given an input array `prices`, where `prices[i]` represents the price of a Bitcoin on day `i`. The objective is to find the maximum difference between any two days given the condition that the buy operation must occur before the sell operation in order to constitute a valid transaction. ### Parameters - `prices`: A list of integers representing the daily Bitcoin prices. The list contains at least one integer. ### Return Value - The function should return an integer – the maximum profit that can be made from performing a single valid Bitcoin transaction. ### Examples ```python # Buying on day 2 (price 2) and selling on day 3 (price 7) yields a max profit of 5 max_profit([7,2,5,2,1,2,6,3]) # Returns: 5 # Buying on day 2 (price 482) and selling on day 5 (price 803) yields a max profit of 321 max_profit([600,482,520,500,803,585]) # Returns: 321 # Buying on day 4 (price 755) and selling on day 6 (price 792) yields a max profit of 37 max_profit([799,801,805,755,783,792]) # Returns: 37 ```