Solution 1 - Brute Force
Iterate through every pair of days using two nested loops. For each pair, compute the profit from buying on the earlier day and selling on the later day. Track and return the maximum profit found.
Solution 2 - Single Pass (Track Minimum Price)
Traverse the array once, keeping track of the minimum price seen so far. At each step, compute the profit if selling at the current price and update the maximum profit accordingly.
Solution 3 - Two Pointers
Use a left pointer (buy day) and a right pointer (sell day). If the sell price is higher than the buy price, calculate the profit and update the maximum. Otherwise, move the buy pointer to the current sell day since we found a cheaper price. Always advance the sell pointer.