• + 9 comments

    Great answer, but how 'bout checking input params for runtime exceptions? With 9 test cases, you never know...

    static boolean isAnagram(String A, String B) {
       //Complete the function
       Boolean retValue = false;
       if(A != null && B != null) {
           char [] arrayA = A.toLowerCase().toCharArray();
           char [] arrayB = B.toLowerCase().toCharArray();
           Arrays.sort(arrayA);
           Arrays.sort(arrayB);
           retValue = Arrays.equals(arrayA, arrayB);
       }
       return retValue;
    }