DrawCode Practice Problem

Best Time to Buy and Sell Stock

You are given an array `prices` where `prices[i]` is the price of a stock on day `i`. Return the maximum profit from one buy and one sell. If no profit is possible, return 0.


Interactive Visualizer Workspace

Explore step-by-step interactive animations, memory state tracking, and live multi-language execution in DrawCode.

Launch Interactive Visualizer