Best Time to Buy and Sell Stock Variants

Given an integer array prices where prices[i] is the price of a given stock on the ith day, you are only allowed to complete at most one transaction (i.e., buy one and sell one share of the stock), de...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: