Algorithm · Ramp · Medium
You are given a list of daily stock price records. Each record consists of a date (formatted as YYYY-MM-DD), a stock symbol (a string of 1 to 20 characters), and the closing price of that stock on that day (a positive integer). You want to achieve the maximum possible profit with at most one trade: you may buy one share of any stock on some day and sell it on a later day (the sell date must be strictly after the buy date). You cannot buy and sell different stocks—the entire…