1public boolean isAnagram(String s, String t) {
2 if (s.length() != t.length()) {
3 return false;
4 }
5 int[] counter = new int[26];
6 for (int i = 0; i < s.length(); i++) {
7 counter[s.charAt(i) - 'a']++;
8 counter[t.charAt(i) - 'a']--;
9 }
10 for (int count : counter) {
11 if (count != 0) {
12 return false;
13 }
14 }
15 return true;
16}
17