MASTERMIND First look for exact matches. Correct answer is: 1234 Guess: 3333 12@4 33@3 Count digits in both correct answer and guess 0: 1: 1 2: 1 3: 3 4: 4 5: 6: 7: 8: 9: Add up the minimums per digit and that is the number of correct digits in incorrect spots. Correct Answer: 1234 Guess: 4135 First find exact answers: We have one correct digit in the correct place. Remove these 12@4 41@5 Compute number of each digit in correct answer and in guess 0: 1: 1 1 2: 1 3: 4: 1 1 5: 1 6: 7: 8: 9: Compute min of each digit 0: 0 1: 1 2: 0 3: 0 4: 1 5: 0 6: 0 7: 0 8: 0 9: 0 Sum of the minimums is 2. There are 2 correct digits in incorrect locations.