时间: 2020-11-24|37次围观|0 条评论

样例

给出"abAcD",一个可能的答案为"acbAD"

挑战 

在原地扫描一遍完成

 

上一个无脑解

static bool cmp(const char &a, const char &b)  
{    
     return (int)a>(int)b;  
}  

void sortLetters(string &chars) {
     sort(chars.begin(), chars.end(), cmp);
}

 

转载于:https://www.cnblogs.com/TheLaughingMan/p/8322479.html

原文链接:https://blog.csdn.net/weixin_30342827/article/details/98105456

本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。

本博客所有文章如无特别注明均为原创。
复制或转载请以超链接形式注明转自起风了,原文地址《49. 字符大小写排序
   

还没有人抢沙发呢~