In this post I want to describe about a series of puzzles called weighing puzzles. These puzzle vary in hardness from simple to extremely mathematical involving either expertise in some fields or extreme ingenuity. Either you know it or you figure out it using extreme intelligence. So here is the chance for some people to burn your grey cells.

I am putting forward three puzzles with varying range of hardness. Sometimes you may feel the hardest one is very easy for you have already come across the theory, but I still made it the hardest for the people who will be solving it with out knowing the theory behind it, giving them an option to figure out a small part in evolution of computational history.

There is a shopkeeper who wants to weigh things who has a common balance. He must be in a position to weigh things of all possible integral weighing units from 1 to a given maximum sum. The question will be either about how many weights you will need or how will you weigh.

Problem 1: One Side Only (Simple Interview Question for Phone Screening usually)

In this version of the problem shopkeeper can only place the weights in one side of the common balance. For example if shopkeeper has weights 1 and 3 then he can measure 1,3 and 4 only. Now the question is how many minimum weights and name the weights you will need to measure all weights from 1 to 1000. This is a fairly simple problem and very easy to prove also.

Problem 2: Both Sides (Medium:5 to 10 mins onsite interview question)

This is same as the first problem with the condition of placing weights on only side of the common balance being removed. You can place weights on both side and you need to measure all weights between 1 and 1000.For example if you have weights 1 and 3,now you can measure 1,3 and 4 like earlier case, and also you can measure 2,by placing 3 on one side and 1 on the side which contain the substance to be weighed. So question again is how many minimum weights and of what denominations you need to measure all weights from 1kg to 1000kg.

Problem 3: Incremental (Hard)

This is an altogether different one in the same scenario. You have to make 125 packets of sugar with first one weighing 1 kg, second 2 kg, third 3 kg etc ...and 125th one weighing 125kg.You can only use one pan of the common balance for measurement for weighing sugar, the other pan had to be used for weights i.e. weights should be used for each weighing.It has come into notice that moving weights into and out of the pan of the balance takes time and this time depends on the number on the number of weights that are moved. For example - If we need to measure 4 kg using weights 1 and 3 only, it will take twice as much time needed to measure 1 kg. Lets say we want to make sugar packets of weights 1,3,4 using weights 1 and 3 only. For this first we measure 1 kg, with 1 unit of time, we place 3 kg along with 1 kg and measure 4kg with again 1 unit of time, and finally we move 1kg out of pan to measure 3kg in 1 unit of time. So in 3 units of time we could measure 1,3 and 4kg using weights 1 and 3 only.

Now you have to make sugar packets of all weights from 1 to 125 in minimum time, in other words in minimum movement of weights. The question here is to find out the minimum number of weighs needed and the weight of each the weights used and the strategy to be followed for the creation of 125 packets of sugar.

Please post your solutions as comments.Solution will be posted soon in the blog.If any where its obfuscated or simple wrong pls feel free to correct.

## 49 comments:

"For example if shopkeeper has weights 1 and 3 then he can measure 1,3 and 4 only."

Surely he can measure 2.

Assuming he can't, I'd say 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 are the required weights.

Well I do not think the questions are that difficult.

In the first case, the poster is correct, it is simply the weights: 1, 2, 4, 8, 16, 32, 64, 128, 512

In the second case, we need to get subtractive logic involved as well. A quick analysis reveals that this means that we need to work in base 3 instead of 2 cause we only have three options. And for getting up to 1000 we then need the weights: map (3^) [0..6] meaning 7 weights.

In the third case it's also not so very difficult,. For some reason it reminds me of gray numbers, although in this case the bit encoding is fixed (the weights). The principle is the same, basically you want to minimize bitflips. So the maximum weight was 125, so we need 7 weights: map (2^) [0..6]. All that is required now is to traverse the space of all bits (except for the numbers 126 and 127 on, though if we include those number that's just two weight changes more cause each number can be arrived to by one weight change)

so that at each step we only flip one bit.

With respect to the medium problem, if the unknown object has a whole number weight (1, 2, 3 ... but not 3.14 or 1.618), you do not need a one, the lightest weight should be a two.

As christophe points out, you can then work base 3 so the sequence goes { 2, 6, 18, ... } and not { 1, 3, 9, ... }

excellent answers ....Christophe (vincenz)... :-) !!

for medium ....it is 1,3,7,23,69,207,415,831.

This goes in a pattern like prev_num*2 + 1

sorry it is sum of prev nums

i dont think roganwald solution is correct.how can some body weight for ,1 kg,3kg for expample with the denomanation of {2,6,18,...}....

I'm not computer guy, so let me talk ppure high school maths.

Basically its sum of geometric progession with first term=1 and common ratio=2.

a,ar,ar2,ar3....ar9=No of terms:10

So, sum of first 10 terms is

1023

I.e n=10

SO 10 weights are required

Rishi's solution is looking quite ok...

so is the final answer 125?

The third one has 2 pans.. one for measuring sugar and other for weights. first use the 1kg weight to measure one kg sugar. Now use this sugar and a 3 kg on the weigh pan to measure 2 kg and so on....

The sequence is 1,3,9,27,81.... this will end up the process in min time.

For easy solution is 1,2,4,8,16,32,64,128,256,512 and medium answer is 1,3,8,16,32,64,256,512

Check interview puzzles for more puzzle with answers like this.

For Hard problem.. the solution is 1,3,9,27,81 and we will measure in a sequence ..i.e., 1,(3-1),3,3+1,.....

I think this might be the best solution

for medium, the solution could be 1,3,12,33,99,297,891

Hi,

For the first question..

Can you prove/disprove that the set

(1,2,4,8,16,32,64,128,256 and 512) is the only sets of 10 weights that can be used to weigh all the weights from 1 to 1000 kg?

Great Blog with very good posts .Can you please tell me that how much time you take to create this wonderful blog,although i am new on internet but your work is very good and i appreciate your work.

Aptitude test

I have been asked the same question in one of the interview - How many minimum weighs required to measure weight from 1 to 60 kg?

If use one side balance (1,2,4,8,16,32 = 6 weighs)

If use both side balance

(1,3,9,27,81 = 5 weighs)

http://iamsoftwareengineer.blogspot.com Check out software aspirants

explain the third one without using gray coding scheme

I'm not a genius but bear with me.

Is this correct for 3?

1x1KG weight.

Measure 1KG bag

Move 1KG bag to other side

Measure 2KG bag

Remove 1KG bag

Move 2KG bag to other side

Measure 3KG bag

Following this process till you reach 125

A loop

measure N bag against N-1 bag + 1KG weight

Remove N-1 bag and replace with N bag

Repeat until N = 125

Good collection of puzzles.

Thank you for sharing such a useful information. It was so useful. Please visit

GKyou are posting a good information for people and keep maintain and give more updates too.

seo company india

you are giving a very interesting post and it is usefull.

informatica training in chennai

your post conveys a good messages and interesting things and give more updates.

digital marketing company in india

Interesting blog post.This blog shows that you have a great future as a content writer.waiting for more updates...

Digital Marketing Company in India

Digital Marketing Services in India

Digital Marketing Agency in India

Digital Marketing Companies in India

Digital Marketing Company India

Digital Marketing Companies India

Thank you for taking the time to provide us with your valuable information. We strive to provide our candidates with excellent care.As always, we appreciate you confidence and trust in us.

Best Training Institute in chennai

i like this blog.Thanks for sharing post.Which is the Best Website Designing Company in Delhi NCR?

Thanks for sharing post Which is the Best SEO Company in Delhi NCR?

Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

rpa training in chennai

rpa training in bangalore

rpa course in bangalore

best rpa training in bangalore

rpa online training

thanks for giving that type of information. ielts coaching in gurgaon

It would have been the happiest moment for you,I mean if we have been waiting for something to happen and when it happens we forgot all hardwork and wait for getting that happened.

Data Science training in rajaji nagar | Data Science Training in Bangalore

Data Science with Python training in chennai

Data Science training in electronic city

Data Science training in USA

Data science training in pune

After seeing your article I want to say that the presentation is very good and also a well-written article with some very good information which is very useful for the readers....thanks for sharing it and do share more posts like this.

python course in pune

python course in chennai

python course in Bangalore

This is a nice article here with some useful tips for those who are not used-to comment that frequently. Thanks for this helpful information I agree with all points you have given to us. I will follow all of them.

Java training in Bangalore | Java training in Jaya nagar

Java training in Bangalore | Java training in Electronic city

Java training in Chennai | Java training institute in Chennai | Java course in Chennai

Java training in USA

Really you have done great job,There are may person searching about that now they will find enough resources by your post

Best Devops training in sholinganallur

Devops training in velachery

Devops training in annanagar

Devops training in tambaram

I read this post two times, I like it so much, please try to keep posting & Let me introduce other material that may be good for our community.

Data Science course in Chennai | Best Data Science course in Chennai

Data science course in bangalore | Best Data Science course in Bangalore

Data science course in pune | Data Science Course institute in Pune

Data science online course | Online Data Science certification course-Gangboard

Data Science Interview questions and answers

Data Science Tutorial

Great Article… I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because, they are becomes a more and more interesting from the starting lines until the end.

rpa training in chennai

rpa training in bangalore

rpa training in pune

rpa training in marathahalli

rpa training in btm

best rpa training in chennai

Does your blog have a contact page? I’m having problems locating it but, I’d like to shoot you an email. I’ve got some recommendations for your blog you might be interested in hearing.

AWS Training in Chennai |Amazon Web Services Training in Chennai

AWS Training in Rajaji Nagar |Best Amazon Web Services Training in Rajaji Nagar

AWS Amazon Web Services Training in Chennai | AWS Training and Certification for Solution Architect in Chennai

AWS Training Institute in Bangalore | AWS Course in Bangalore

Thanks Admin for sharing such a useful post, I hope it’s useful to many individuals for developing their skill to get good career.

Java training in Bangalore | Java training in Indira nagar

Java training in Bangalore | Java training in Rajaji nagar

Java training in Bangalore | Java training in Marathahalli

Java training in Bangalore | Java training in Btm layout

Excellent post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.

Best Devops online Training

Online DevOps Certification Course - Gangboard

Would you suggest starting with a free platform like Word Press or go for a paid option? There are so many choices out there that I’m completely confused. Any suggestions? Thanks a lot.

AWS Training in Bangalore electronic city| AWS Training in Bangalore BTM Layout

AWS Training in Pune with placements | AWS Training in Pune kharadi

AWS Training in Chennai review |Best AWS Training in Chennai tnagar

Best AWS Amazon Web Services Training in Chennai | Best AWS Training centers in Chennai

AWS Online Training in india | AWS online training cost

شركة عزل الاسطح بالخبر

شركة كشف تسربات المياه بعنك

شركة كشف تسربات المياه بسيهات

Nice post. it is very interesting and informative. Thank you for the sharing.

Deer Hunting Tips Camping Trips Guide DEER HUNTING TIPS travel touring tips

Well thanks for the information, do not forget to visit my blog too.

Still Hunting Method

Hunting psych tips Survival Tips Travel Touring Tips

Thanks for sharing this quality information with us. I really enjoyed reading.

travel trekking tips

see the link Tent Camping 101 Exploring Smithriver

ستاسو مضمون ډیر معنی دی

chó Corgi

bán chó Corgi

chó Corgi giá bao nhiêu

mua chó Corgi

Post a Comment