Divide and conquer is a recursive problem-solving approach that breaks a problem into smaller, more manageable subproblems, solves them individually, and then combines their solutions to solve the original problem.
Dynamic programming is an algorithmic technique that efficiently solves problems by breaking them down into smaller overlapping subproblems and storing the solutions to these subproblems to avoid redundant computations.
You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.