Ad
  • Custom User Avatar

    This solution is not optimal, because duplicates are removed after permutations are built. You can remove duplicates while permutations are calculuated, thus speeding up the process.