leetcode + 判断两字符串是不是同构子串。就是一串字符串,两种顺序排列。先sort然后判别

https://leetcode.com/problems/valid-anagram/description/

class Solution {
public:
    bool isAnagram(string s, string t) {
        sort(s.begin(), s.end());
        sort(t.begin(), t.end());
        return s==t;
    }
};

同构: 字母所含相同,顺序不同

猜你喜欢

转载自blog.csdn.net/u013554860/article/details/81128034