class Solution {
public:
int maxProfit(vector<int> &prices) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
//sum all the consecutive positive diff
int sum = 0;
for (int i = 1; i < prices.size(); ++i)
sum += max(0, prices[i]-prices[i-1]);
return sum;
}
};