码迷,mamicode.com
首页 > 其他好文 > 详细

判断字符串是否是颠倒的?

时间:2016-06-22 19:00:09      阅读:139      评论:0      收藏:0      [点我收藏+]

标签:

class {
public:
 bool isAnagram(string s, string t) {
        if(s.size() != t.size()) return false;
        sort(s.begin(),s.end());
        sort(t.begin(),t.end());
        int n = s.size();
        for(int i = 0;i<n;i++){
            if(s[i]!=t[i]) return false;
        }
        return true;
    }
};

 

判断字符串是否是颠倒的?

标签:

原文地址:http://www.cnblogs.com/li-daphne/p/5608135.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!