my effecient and simple java solution


  • 0
    E

    ''' public class Solution {
    public boolean isAnagram(String s, String t) {
    char[] list1=new char[s.length()];
    char[] list2=new char[t.length()];
    list1=s.toCharArray();
    list2=t.toCharArray();
    System.out.println(list1);
    System.out.println(list2);
    Arrays.sort(list1) ;
    Arrays.sort(list2);
    String s1=new String(list1);
    String s2=new String(list2);
    if(s1.equals(s2)) return true;
    else return false;

    }
    

    }
    '''


Log in to reply
 

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