Two Pills Each Day-Asked in Interviews

Question:

You are on a strict medical regimen that requires you to take two types of pills each day. You must take exactly one A pill and exactly one B pill at the same time. The pills are very expensive, and you don’t want to waste any. So you open the bottle of A pills, and tap one out into your hand. Then you open the bottle of B pills and do the same thing — but you make a mistake, and two B pills come out into your hand with the A pill. But the pills are all exactly identical. There is no way to tell A pills apart from B pills. Is it possible to satisfy your regimen and take exactly one of each pill at the same time, without wasting any pills?

Solution: Yes

Cut each pill in half and divide them into two piles. Then, take another A pill from the bottle, cut it in half, and put each half in one of the piles. Now, each pile contains two halves from each type of pill, so you just take one of the piles (and the other the next day).

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.

--

--

--

Upskilling students for tech placements!

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

8 Questions I Ask When I’m Being Interviewed

Learning to Ask for Help

#just start experience.

Ways to Make Your Question Look Impressive In 5 Days.

15 tips for public speaking that apply to shining at work, and just about everywhere else.

Build Your Network Like a Pro In spite of Being a Fresher

First Contacts

Dealing With Bias During a Pandemic

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
Placewit

Placewit

Upskilling students for tech placements!

More from Medium

World Trips Puzzle

One interview, Many learnings

Meta / Amazon / Google / Microsoft Interview Question: Wildcard Matching Solution | LeetCode-44…

14 Days Study Plan to Crack Algo I