标签:class span turn tor return min vector style div
class Solution { public: int maxProfit(vector<int>& prices) { if (prices.size() == 0) return 0; int res = 0, _min = prices[0]; for (auto p : prices) { if (p < _min) _min = p; res = max(res, p - _min); } return res; } };
121. Best Time to Buy and Sell Stock
标签:class span turn tor return min vector style div
原文地址:https://www.cnblogs.com/JTechRoad/p/9063297.html