Skip to content

Instantly share code, notes, and snippets.

@joriki
Created March 1, 2022 03:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joriki/9b07ea950e77458d0426040ec698a2c7 to your computer and use it in GitHub Desktop.
Save joriki/9b07ea950e77458d0426040ec698a2c7 to your computer and use it in GitHub Desktop.
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class Question4393372 {
public static void main(String [] args) {
Set<String> combinations = new HashSet<>();
for (int i = 1000;i < 3000;i++) {
char [] c = String.valueOf(i).toCharArray();
Arrays.sort(c);
combinations.add(new String(c));
}
System.out.println(combinations.size());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment