प्रश्न
00:00

3. Best Time to Buy and Sell Stock

आसानऐरेAmazonMicrosoft

Given an array prices, return the maximum profit you can achieve from one buy and one sell.

उदाहरण 1:

इनपुट: prices = [7,1,5,3,6,4]
आउटपुट: 5

उदाहरण 2:

इनपुट: prices = [7,6,4,3,1]
आउटपुट: 0

सीमाएँ:

  • 1 <= prices.length <= 10^5
मुख्य कोड मोड
● अपने आप सहेजा गयापंक्ति 1, कॉलम 1