Use java.util.Arrays.Easy code,diffrent way.

  • 0

    At first when I saw this problem,I considered that sort the char[] is an easy way.
    my code:

    public static boolean isAnagram(String s, String t) {
            char[] str = s.toCharArray();
            char[] ttr = t.toCharArray();
            return Arrays.equals(str,ttr);

Log in to reply

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