C++sort函数用法笔记
函数回调
sort(strs.begin(), strs.end(), [](string& x, string& y){ return x + y < y + x; });
数组从小到大排序:
sort(nums.begin(),nums.end());
数组从大到小排序:
sort(nums.begin(),nums.end(),greater<int>());
函数回调
sort(strs.begin(), strs.end(), [](string& x, string& y){ return x + y < y + x; });
数组从小到大排序:
sort(nums.begin(),nums.end());
数组从大到小排序:
sort(nums.begin(),nums.end(),greater<int>());