In: Computer Science
CAN YOU OPEN THE LOCK USING THESE CLUES?
682 ONE DIGIT IS RIGHT AND IN ITS PLACE
614 ONE DIGIT IS RIGHT BUT IN THE WRONC PLACE
206 TWO DIGITS ARE RIGHT BUT BOTH ARE IN THE WRONG PLACE.
738 ALL DIGITS ARE WRONG
380 ONE PICIT IS RIGHT BUT IN THE WRING PLACE.
1. 042. Yes, 042 is the key to this lock. How? Please look into the below-detailed explanation.
2. Begin with the first number. Here one digit is right and well placed, and the three digits we are having here is 682. If we take 6 as the right digit, it will contradict the second statement where one digit is right but wrongly placed, but in the first and second statements, both the 6 are at the same place. So 6 is wrong, and we will discard it. Now take 8 as a number, but 738, all the digits are wrong from the fourth statement. So we will discard 8 too. Finally, from this statement, 2 is the correct digit in third place.
3. For the time being, skip the second statement before this first look into the third statement having the number 206. Here two digits are right, but both are wrongly placed. We already discarded 6 and accepted 2 in third place. Hence other accepted number is 0, which is wrongly placed, so the correct position of the 0 is the first place. Now, Finally, we have two numbers 0 in the first place and 2 in third place.
4. Now look into the second statement having the number 614. Here one digit is right but wrongly placed. In this number, 6 has already been discarded. If we consider 1 as the correct number, it will come either at the first or third place because of the wrongly placed condition, but both these places are already filled. Hence we will discard 1 as well. So, our accepted digit is 4, but it is wrongly placed. So, the correct place of 4 in second place. Finally, we have all the three digits as 0 in the first place, 4 in second place, and 2 in third place.
Our number will 042.
Note:- No need to look into the last statement having number 380 as it is of no use, just given for confusion.