leetcode [#242] | GCidea's blog
目录

题目
Given two strings s and t, write a function to determine if t is an anagram of s.
Example:
s = “anagram”, t = “nagaram”, return true.
s = “rat”, t = “car”, return false.Note:
You may assume the string contains only lowercase alphabets.
解决方案
1 | public class Solution { |
注意事项
- 两个字符串互为字谜,首先长度要一样。
- 将两个字符串排序,只要对应位不一样,则肯定不是互为字谜。