Sharing my simple and clear C++ solution
int maxProfit(vector<int> &prices) {\n        int maxPro = 0;\n        int minPrice = INT_MAX;\n        for(int i = 0; i < prices.size(); i++){\n            min
    int maxProfit(vector<int> &prices) {\n        int maxPro = 0;\n        int minPrice = INT_MAX;\n        for(int i = 0; i < prices.size(); i++){\n            minPrice = min(minPrice, prices[i]);\n            maxPro = max(maxPro, prices[i] - minPrice);\n        }\n        return maxPro;\n    }\n\nminPrice is the minimum price from day 0 to day i. And maxPro is the maximum profit we can get from day 0 to day i. \n\nHow to get maxPro? Just get the larger one between current maxPro and prices[i] - minPrice.
['Greedy', 'C++']