My simple java solution for anagram


  • 0
    S

    public boolean isAnagram(String s,String t)

    {
    	char[]a;
    	char[]b;
    	a=s.toCharArray();
    	b=t.toCharArray();
    	Arrays.sort(a);
    	Arrays.sort(b);
    	return(Arrays.equals(a, b));
    
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.