#include <algorithm>
#include <string>
class Same {
public:
bool checkSam(string stringA, string stringB) {
// write code here
sort(stringA.begin(), stringA.end());
sort(stringB.begin(), stringB.end());
if(stringA == stringB){
return true;
}
return false;
}
};
先将string进行排序(以ASCII值),然后直接相比较就行了



京公网安备 11010502036488号