// short int long float double bool char string void// array vector stack queue auto const operator// class public private static friend extern// sizeof new delete return cout cin memset malloc// relloc size length memset malloc relloc size length// for while if else switch case continue break system// endl reverse sort swap substr begin end iterator// namespace include define NULL nullptr exit equals// index col row arr err left right ans res vec que sta// state flag ch str max min default charray std// maxn minn INT_MAX INT_MIN push_back insert// back empty find pop_backclassSolution{public:
int result =0;
int findContentChildren(vector<int>& g, vector<int>& s){sort(g.begin(),g.end());sort(s.begin(),s.end());
int index = s.size()-1;for(int i = g.size()-1; i >=0; i--){if(index >=0&& s[index]>= g[i]){
result++;
index--;}}return result;}};
classSolution{public:
int maxSubArray(vector<int>& nums){
int result =INT32_MIN;
int count =0;for(int i =0; i < nums.size(); i++){
count += nums[i];if(count > result){// 取区间累计的最大值(相当于不断确定最大子序终止位置)
result = count;}if(count <=0) count =0;// 相当于重置最大子序起始位置,因为遇到负数一定是拉低总和}return result;}};