Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Solution {
- public boolean isAnagram(String s, String t) {
- int[] charCount = new int[256];
- for(char a: s.toCharArray()) {
- charCount[a]++;
- }
- for(char a:t.toCharArray()) {
- charCount[a]--;
- }
- for(int i:charCount) {
- if (i!=0) {
- return false;
- }
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement