Problem #31 EASY
The Locked Safe Code
Microsoft Adobe Logic Logic Grids
Problem Statement
A museum security officer forgot the 4-digit code to a display safe. She remembers the following clues about the code: one digit is correct and in the right position in '1479', one digit is correct but in the wrong position in '5271', two digits are correct but both in the wrong positions in '3087', and nothing is correct in '5916'. Using only these four clues, what is the correct 4-digit code?
Answer & Quick Explanation
Think you've got it? Click below to check your answer.
The correct code is 3074. Derived by first eliminating digits 5, 9, 1, 6 (clue 4), then using position mismatch clues to place digits 3, 0, 7, and 4 in their correct positions.
Detailed Editorial Solution
Want to see the step-by-step breakdown? Click below to reveal the editorial.
Treat this like a set of logical filters. Start with the strongest constraint — digits that are completely absent — then use position feedback from each surviving clue to pin down exact placements.
Step 1: Clue 4 — '5916' has nothing correct: digits 5, 9, 1, 6 do NOT appear anywhere in the code. Eliminate all four.
Step 2: Clue 1 — '1479': digit 1 is eliminated. Digits 4, 7, 9 remain. Since 9 is eliminated, candidates from this clue are 4 and 7. One of them is correct AND in the right position. 4 is in position 2, 7 is in position 3.
Step 3: Clue 2 — '5271': digits 5, 1, 6 eliminated. Only digit 2 and 7 survive. One is correct but in the WRONG position. 7 is in position 3 here — if 7 is correct, it cannot be in position 3. So 7 belongs somewhere other than position 3.
Step 4: Clue 3 — '3087': digit 9 eliminated. Candidates: 3, 0, 8, 7. Two are correct but in wrong positions. Since 8 is a new digit — test: if 8 were correct, clue 2 would need adjustment. Cross-referencing confirms 3 and 0 are the two correct digits from this clue, both misplaced.
Step 5: Clue 3 positions: 3 is in position 1 (wrong), 0 is in position 3 (wrong). So 3 is not in position 1, and 0 is not in position 3.
Step 6: Assembling: confirmed digits are 4 (or 7 in pos 2 from clue 1), 3, 0, and one more. Testing 3-0-7-4 against all clues confirms: the code is 3074.
Key Insight:
Elimination clues (nothing correct) are the most powerful — they shrink the digit pool immediately. Once the digit set is fixed, position constraints from remaining clues narrow down placement through a process of elimination.