Given an array prices where prices[i] is the price on day i, find the maximum profit from one buy and one sell. Return 0 if no profit is possible.
Input: prices = [7,1,5,3,6,4] Output: 5 (buy day 2 at 1, sell day 5 at 6) Input: prices = [7,6,4,3,1] Output: 0
Unlock hints progressively — start gentle, go deeper only if needed.
Level 1: Gentle Nudge
A subtle direction
Level 2: Approach
The algorithm to use
Level 3: Detailed
Step-by-step guidance
to save progress and use AI features