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.
public class Solution {
public boolean isAnagram(String s, String t) {
if(s==null||t==null||s.length()!=t.length())
return false;
int[] a=new int[256];
int[] b=new int[256];
for(int i=0;i<s.length();i++){
char c1=s.charAt(i);
char c2=t.charAt(i);
a[c1]++;
b[c2]++;
}
for(int i=0;i<s.length();i++){
char c=s.charAt(i);
if(a[c]!=b[c])
return false;
}
return true;
}
}