Example: "god" permutation will be "dog"
Solution:
public String sort(String s)
{
char[] content = s.toCharArray();
java.util.Arrays.sort(content);
return new String(content);
}
public boolean permutation(String s ,String t)
{
if(s.lenght() ! = t.length())
{
return false;
}
return sort(s).equals(sort(t));
}
Though this solution is not as optimal in some cases.