Ramp·Software Engineer·Technical Phone Screen
- Given an unsorted log of stock trades, each with a date, ticker symbol, and price, find the maximum profit from a single buy-then-sell transaction where the sell date must be strictly later than the buy date and both trades share the same symbol. Return 0 if no profitable transaction exists.
“My first instinct was to just sort everything by date and run the standard min-so-far sweep, but then I realized you have to track each symbol separately since you can't buy AAPL and sell GOOG.”