How about this one? Given a map of timestamps to stock prices for a single day, return the best times to have bought and sold them respectively, and the total profit you would have earned.
Note: Yup, a dictionary of timestamps to stock prices, in Python terms you can assume it's like Dict[datetime, float] (that is, if datetimes are allowed as dictionary keys. If not assume they're strings that are easily parsed into datetime)
How about this one? Given a map of timestamps to stock prices for a single day, return the best times to have bought and sold them respectively, and the total profit you would have earned.
Note: Yup, a dictionary of timestamps to stock prices, in Python terms you can assume it's like
Dict[datetime, float]
(that is, if datetimes are allowed as dictionary keys. If not assume they're strings that are easily parsed into datetime)Assume it's for one day and for one stock