问题很简单,要观察最大值和最小值的变化,我们需要保证更大值总出现在更小值的后面。
So, here is how I tackled it.
Instead of going forward, I scanned through the list of prices backward to store the current maximum number. Update the biggest difference along the way.
问题很简单,要观察最大值和最小值的变化,我们需要保证更大值总出现在更小值的后面。
So, here is how I tackled it.
Instead of going forward, I scanned through the list of prices backward to store the current maximum number. Update the biggest difference along the way.