9

C++, 5000 random test cases in 6.1 seconds
This is practically fast, but there may exist some testcases that make it slow. Complexity unknown.
If there are multiple solutions, it will print them all. Example.
Explanation:
Count the occurrences of digits.
List all possible answers.
Check if a...