标签:截图 maximum lin img fit image images 技术分享 -128
代码:
class Solution {
public:
/**
* @param prices: Given an integer array
* @return: Maximum profit
*/
int maxProfit(vector<int> &price) {
int re = 0;
if(price.size()<2)
return re;
int lowest = price[0];
for(int i=1;i<price.size();i++)
{
int cur = price[i];
re = max(re,cur-lowest);
lowest = min(lowest,cur);
}
return re;
}
};
lintcode截图:
标签:截图 maximum lin img fit image images 技术分享 -128
原文地址:http://www.cnblogs.com/aly15109725486/p/7235695.html