Skip to main content
Commonmark migration
Source Link

#Java, 218 Bytes

Java, 218 Bytes

First time I've ever written Java...

Golfed:

import java.util.Arrays;boolean M(String a,String b){char[]A=a.toUpperCase().replace(" ","").toCharArray();char[]B=b.toUpperCase().replace(" ","").toCharArray();Arrays.sort(A);Arrays.sort(B);return Arrays.equals(A,B);}

Ungolfed:

import java.util.Arrays;
public class ManageTrashSo {
    public boolean M(String a, String b) {
    char[] A = a.toUpperCase().replace(" ", "").toCharArray();
    char[] B = b.toUpperCase().replace(" ", "").toCharArray();
    Arrays.sort(A);
    Arrays.sort(B);
    return Arrays.equals(A, B);
   }
}

Testing:

    ManageTrashSo manageTrashSo = new ManageTrashSo();

    //True
    System.out.println(manageTrashSo.M("Lynn", "Nyl N"));
    System.out.println(manageTrashSo.M("Digital Trauma", "Tau Digital Arm"));
    
    //False
    System.out.println(manageTrashSo.M("Android", "rains odd"));
    System.out.println(manageTrashSo.M("In between days", "bayed entwine"));

#Java, 218 Bytes

First time I've ever written Java...

Golfed:

import java.util.Arrays;boolean M(String a,String b){char[]A=a.toUpperCase().replace(" ","").toCharArray();char[]B=b.toUpperCase().replace(" ","").toCharArray();Arrays.sort(A);Arrays.sort(B);return Arrays.equals(A,B);}

Ungolfed:

import java.util.Arrays;
public class ManageTrashSo {
    public boolean M(String a, String b) {
    char[] A = a.toUpperCase().replace(" ", "").toCharArray();
    char[] B = b.toUpperCase().replace(" ", "").toCharArray();
    Arrays.sort(A);
    Arrays.sort(B);
    return Arrays.equals(A, B);
   }
}

Testing:

    ManageTrashSo manageTrashSo = new ManageTrashSo();

    //True
    System.out.println(manageTrashSo.M("Lynn", "Nyl N"));
    System.out.println(manageTrashSo.M("Digital Trauma", "Tau Digital Arm"));
    
    //False
    System.out.println(manageTrashSo.M("Android", "rains odd"));
    System.out.println(manageTrashSo.M("In between days", "bayed entwine"));

Java, 218 Bytes

First time I've ever written Java...

Golfed:

import java.util.Arrays;boolean M(String a,String b){char[]A=a.toUpperCase().replace(" ","").toCharArray();char[]B=b.toUpperCase().replace(" ","").toCharArray();Arrays.sort(A);Arrays.sort(B);return Arrays.equals(A,B);}

Ungolfed:

import java.util.Arrays;
public class ManageTrashSo {
    public boolean M(String a, String b) {
    char[] A = a.toUpperCase().replace(" ", "").toCharArray();
    char[] B = b.toUpperCase().replace(" ", "").toCharArray();
    Arrays.sort(A);
    Arrays.sort(B);
    return Arrays.equals(A, B);
   }
}

Testing:

    ManageTrashSo manageTrashSo = new ManageTrashSo();

    //True
    System.out.println(manageTrashSo.M("Lynn", "Nyl N"));
    System.out.println(manageTrashSo.M("Digital Trauma", "Tau Digital Arm"));
    
    //False
    System.out.println(manageTrashSo.M("Android", "rains odd"));
    System.out.println(manageTrashSo.M("In between days", "bayed entwine"));
Source Link
Pete Arden
  • 1.2k
  • 7
  • 9

#Java, 218 Bytes

First time I've ever written Java...

Golfed:

import java.util.Arrays;boolean M(String a,String b){char[]A=a.toUpperCase().replace(" ","").toCharArray();char[]B=b.toUpperCase().replace(" ","").toCharArray();Arrays.sort(A);Arrays.sort(B);return Arrays.equals(A,B);}

Ungolfed:

import java.util.Arrays;
public class ManageTrashSo {
    public boolean M(String a, String b) {
    char[] A = a.toUpperCase().replace(" ", "").toCharArray();
    char[] B = b.toUpperCase().replace(" ", "").toCharArray();
    Arrays.sort(A);
    Arrays.sort(B);
    return Arrays.equals(A, B);
   }
}

Testing:

    ManageTrashSo manageTrashSo = new ManageTrashSo();

    //True
    System.out.println(manageTrashSo.M("Lynn", "Nyl N"));
    System.out.println(manageTrashSo.M("Digital Trauma", "Tau Digital Arm"));
    
    //False
    System.out.println(manageTrashSo.M("Android", "rains odd"));
    System.out.println(manageTrashSo.M("In between days", "bayed entwine"));