OJ lintcode 两个字符串是变位词

写出一个函数 anagram(s, t) 判断两个字符串是否可以通过改变字母的顺序变成一样的字符串。
您在真实的面试中是否遇到过这个题?
Yes
说明
What is Anagram?

  • Two strings are anagram if they can be the same after change the order of characters.
    样例
    给出 s = "abcd",t="dcab",返回 true.
    给出 s = "ab", t = "ab", 返回 true.
    给出 s = "ab", t = "ac", 返回 false.
class Solution {
public:
    /**
     * @param s: The first string
     * @param b: The second string
     * @return true or false
     */
    bool anagram(string s, string t) {
        // write your code here
        multiset mset;
        for(int i=0;i

你可能感兴趣的:(OJ lintcode 两个字符串是变位词)