Java solution 5 lines


  • 0
    S
    public class Solution {
        public boolean isAnagram(String s, String t) {
            char[] char_s = s.toCharArray();
            char[] char_t = t.toCharArray();
            Arrays.sort(char_s);
            Arrays.sort(char_t);
            return Arrays.equals(char_s, char_t);
        }
    }

Log in to reply
 

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