classSolution{public:
int maxProfit(vector<int>& prices){
int n = prices.size();
vector<int> profit;for(int i =0; i < n; i++){for(int j = i +1; j < n; j++){
int test = prices[j]- prices[i];
profit.push_back(test);}}sort(profit.begin(), profit.end());
int endNum = profit.back();if(endNum>0){return endNum;}else{return0;}}};
classSolution{public:
int maxProfit(vector<int>& prices){
int n =(int)prices.size(), ans =0;for(int i =0; i < n;++i){for(int j = i +1; j < n;++j){
ans =max(ans, prices[j]- prices[i]);}}return ans;}};