• Welcome to the world's largest Chinese hacker forum

    Welcome to the world's largest Chinese hacker forum, our forum registration is open! You can now register for technical communication with us, this is a free and open to the world of the BBS, we founded the purpose for the study of network security, please don't release business of black/grey, or on the BBS posts, to seek help hacker if violations, we will permanently frozen your IP and account, thank you for your cooperation. Hacker attack and defense cracking or network Security

    business please click here: Creation Security  From CNHACKTEAM

Recommended Posts

题目链接:https://leet代码-cn。com/problems/reorder-data-in-log-files/

个人题解:

根据题意:数字日志应该保留原来的相对顺序。因此要采用\(stableSort()\)函数

根据题目意思模拟即可

点击查看代码类别解决方案{

公共:

向量字符串重新排序日志文件(向量字符串日志){

stable_sort(logs.begin(),logs.end(),[](常量字符串一,常量字符串b) {

int x=a.find('),y=b . find(');

auto a1=a.substr(0,x),b1=b.substr(0,y);

auto a2=a.substr(x 1),B2=b . substr(y1);

auto a3=isdigit(a2[0]),B3=is digit(B2[0]);

如果(a3!=b3)返回a3 b3

如果(a3)返回错误的

如果(a2!=b2)返回a2 b2

返回a1 b1

});

返回日志;

}

};

image

Link to comment
Share on other sites