Best Time to Buy and Sell Stock
Easy · Arrays & Strings · about 10 minutes
Asked at Amazon, Meta, Bloomberg, Apple, Atlassian, NVIDIA, Google, Microsoft, JPMorgan Chase, Two Sigma, Hudson River Trading, AMD, ServiceNow, Workday, Asana, Notion, GitLab, Waymo, Broadcom, Canva, Optiver, Epic Games, Anduril, SpaceX, xAI, Airtable, Mistral AI, Rivian, Samsung, Sony, Arm, Rubrik, Glean, Gusto, Jump Trading, Susquehanna (SIG).
prices lists a stock's closing price day by day. You may make a single purchase and then a single sale on some strictly later day. What's the biggest gain you can lock in? If every possible trade loses money, answer 0.