Uber 校园面

Given any array with n numbers representing stock prices on different, find the maximum profit you could make from constantly buying and selling on different days.

For Example:
Given [1,6, 11, 4, 0, 10, 5, 30]
The maximum profit would be: 10 + 10 + 25 = 45.