I've received a question to solve. I've manage to solved it by hand but couldn't find an exact algorithm to solved it.
The question: The user insert a 4 digits number without repetition of any of the digits (can have a leading 0). The algorithm needs to find this number.
There is a check function that received a 4 digits number and returns how many numbers were correct, and how many of the numbers were in the correct place without overlap, and without mentioning which one is. The system has 7 tries.
For example: The user insert the Number: 0584
If the system sends the number: 6549
The return would be:
1 item in place
1 item is correct