Puzzle: You have 5 jars of pills. Each pill weighs 10 grams, except for contaminated pills contained in one jar, where each pill weighs 9 grams. Given a scale, how could you tell which jar had the contaminated pills in just one measurement?
Solution: To find the contaminated Jar, follow this step-wise approach.
- Step 1: Take out 1 pill from jar 1, 2 pills from jar 2, 3 pills from jar 3, 4 pills from jar 4 and 5 pills from jar 5.
- Step 2: Put all these 15 pills on the scale. The correct weight is 150 (15*10). But one of the jars has contaminated pills. So the weight will definitely be less than 150.
- Step 3: If the weight is 149 then jar 1 has contaminated pills because there is only one contaminated pill. If the weight is 148 then jar 2, if the weight is 147 then jar 3, if 146 then jar 4, if 145 then jar 5.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
- Puzzle 29 | (Car Wheel Puzzle)
- Puzzle 39 | (100 coins puzzle)
- Puzzle 9 | (Find the fastest 3 horses)
- The Two Water Jug Puzzle
- Puzzle 1 | (How to Measure 45 minutes using two identical wires?)
- Puzzle 7 | (3 Bulbs and 3 Switches)
- Write a Program to Find the Maximum Depth or Height of a Tree
- Given a string, find its first non-repeating character
- Find the two non-repeating elements in an array of repeating elements
- Find the two repeating elements in a given array
- Find the smallest window in a string containing all characters of another string
- Given a number, find the next smallest palindrome
- Find distance between two nodes of a Binary Tree
- Find if there is a subarray with 0 sum
- Find next greater number with same set of digits
- Find if a given string can be represented from a substring by iterating the substring “n” times
- Find all distinct palindromic sub-strings of a given string
- Find the length of largest subarray with 0 sum
- Find Maximum number possible by doing at-most K swaps
- Find all strings that match specific pattern in a dictionary