Reputation: 181
The problem statement is here
Can someone please help me understand this problem. The problem statement says,
a positive integer 'X' is chosen and each bag should have atleast 'X' fruits, but in the example they are choosing 0. it is confusing here.
Also, they say "you take exactly 'X' fruits from each bag", then in that case, with example 1, as soon as you choose X=1, your present will be come 1 apple and 1 orange and you are done. isn't it?
Please help me understand this. Also any hints on how the thought process of such kind of problems should be will be appreciated.
Thanks!
Upvotes: 0
Views: 133
Reputation: 1893
Let us look at the first example (0):
orange[1]={1}
apple[1]={1}
This means that there is one apple and one orange in the first (and only) bag. You now should choose a X such that there are at least X pieces of fruit in each bag:
This can be 1 or 2
if you choose 1 there are two possibilities: you take out 1 orange or you take out 1 apple.
if you choose 2 you have one present: 1 orange and 1 apple
The answer: 3 possible presents
I hope that makes it a bit more clear for you and you can continue on yourself.
Upvotes: 1