20.11.22 leetcode242

题目链接:https://leetcode-cn.com/problems/valid-anagram/

题意:判断两个字符串是否是字母都相同,只是顺序不同

分析:非常脑瘫,直接排序。。。

class Solution {
public:
    bool isAnagram(string s, string t) {
        sort(s.begin(),s.end());
        sort(t.begin(),t.end());
        if(s==t)return true;
        else return false;
    }
};
原文地址:https://www.cnblogs.com/qingjiuling/p/14021475.html