22. 242. Valid Anagram(由颠倒字母顺序而构成的字)
Given two strings s and t, write a function to determine if t is an anagram of s.
For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.
Note: You may assume the string contains only lowercase alphabets.
Follow up: What if the inputs contain unicode characters? How would you adapt your solution to such case?
思路:同样是利用C++ 的 map 数据结构,注意当两个字符串都为空时应该返回false。
转载于:https://www.cnblogs.com/vincent93/p/6686569.html