3 ms·
I'm sure there are faster ways but a quick and dirty approach would be to count how many of each digit are in the input string, then compare to the expected res
by mbell 13y ago
I'm sure there are faster ways but a quick and dirty approach would be to count how many of each digit are in the input string, then compare to the expected result, which is easy to figure out. This will tell you what digits are missing from the input. There will be at most 3 of them, then just search the input for the possible valid combinations of those digits, as soon as you find one that is missing, you're done.