Minimum Batteries-Puzzle for Interview rounds

Question :

There are 8 batteries, but only 4 of them work. A flashlight needs only 2 working batteries. To guarantee that the flashlight is turned on, what is the minimum number of battery pairs you need to test?

Solution :

To solve this problem, the first step involves naming the batteries, for instance, A, B, C, D, E, F, G, and H. In this problem, you can’t compare 2 items directly. If a combination of two batteries fail to turn the light on, it means either one or both the batteries aren’t working. The batteries are put test consecutively in the order AB, BC, and AC. At most, one of the three batteries between A, B, And C is working, only if none of the pairs work. This also implies that at least three batteries between D, E, F, G, and H must be functional. DE combination is tried next. If they don’t work, at least 2 out of F, G, and H must work. Similarly, try the combinations FG, GH, and FH to positively asset which batteries really work.

Thanks for Reading

Placewit grows the best engineers by providing an interactive classroom experience and by helping them develop their skills and get placed in amazing companies.

Learn more at Placewit. Follow us on Instagram and Facebook for daily learning.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store