Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Day 469 #947

Closed
vaskoz opened this issue Mar 8, 2020 · 1 comment · Fixed by #948
Closed

Day 469 #947

vaskoz opened this issue Mar 8, 2020 · 1 comment · Fixed by #948
Assignees

Comments

@vaskoz
Copy link
Owner

vaskoz commented Mar 8, 2020

Good morning! Here's your coding interview problem for today.

This problem was asked by Facebook.

Mastermind is a two-player game in which the first player attempts to guess the secret code of the second. In this version, the code may be any six-digit number with all distinct digits.

Each turn the first player guesses some number, and the second player responds by saying how many digits in this number correctly matched their location in the secret code. For example, if the secret code were 123456, then a guess of 175286 would score two, since 1 and 6 were correctly placed.

Write an algorithm which, given a sequence of guesses and their scores, determines whether there exists some secret code that could have produced them.

For example, for the following scores you should return True, since they correspond to the secret code 123456:

{175286: 2, 293416: 3, 654321: 0}
However, it is impossible for any key to result in the following scores, so in this case you should return False:

{123456: 4, 345678: 4, 567890: 4}

@vaskoz vaskoz self-assigned this Mar 8, 2020
@vaskoz
Copy link
Owner Author

vaskoz commented Mar 8, 2020

Identical to Day 361: #712

@vaskoz vaskoz mentioned this issue Mar 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant