like if a shopkeeper removes link from 1 , 2 , 3 n say 4 so he has 4 totally separated links so if someone comes and ask for 1 link he can give, if someone comes for 2 links he can give similarly for 3 and 4 but for 5 he can't as he has removed only 4 links.
now use your head to find the correct locations and correct number of links to be removed.
There is a chain with 100 links in it. These links are numbered from 1 to 100. suppose you are a shopkeeper and you want to sell this chain and its not necessary that the buyer will ask for full chain he can ask for any number of links he want to. Now you have to find out what will be the minimum number of links that the shopkeeper should remove and from which positions so that when buyer comes he should be able to give the exact number of links as he/she demands.
As shopkeeper doesn't know what number buyer will ask so one way is to detach all the links from one another but then it will be maximum number of links you have to find minimum number of links and also give the correct positions.
and yes the links can be attached or separated when he gives it to buyer.
Question
Guest
There is a chain with 100 links in it. These links are numbered from 1 to 100. suppose you are a shopkeeper and you want to sell this chain and its not necessary that the buyer will ask for full chain he can ask for any number of links he want to. Now you have to find out what will be the minimum number of links that the shopkeeper should remove and from which positions so that when buyer comes he should be able to give the exact number of links as he/she demands.
As shopkeeper doesn't know what number buyer will ask so one way is to detach all the links from one another but then it will be maximum number of links you have to find minimum number of links and also give the correct positions.
and yes the links can be attached or separated when he gives it to buyer.
Link to comment
Share on other sites
19 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.