class Solution { public: int maxProfit(vector<int>& prices) { int res = 0; int min_val = INT_MAX; for(int i = 0;i < prices.size();i ++){ res = max(res,prices[i] - min_val); min_val = min(min_val,prices[i]); } return res...