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.
public class Solution { public boolean isAnagram(String s, String t) { if(s.length()!=t.length()) return false; StringBuffer sb = new StringBuffer(t); for(int i=0;i<s.length();i++) { int index = sb.indexOf(s.charAt(i)+""); if(index==-1) { return false; } else { sb.deleteCharAt(index); } } return true; } }