I dont remember that statement exactly . Putting it out as per memory.
Ramu has a pile of chocolates.He has to put it in a box with pouches and each pouch can contain unique number of candies between 1 to n.
Ramu draws randomly from pill of chocolates and puts in pouch. All the extra chocolates that can’t be put in pouches, he can eat them.
Inputs
4 13 // capacity of each pouch and number of draws
1 3 2 1 2 3 2 9 5 5 5 5 // chocolates per draw Output
0 0 0 0 1 0 0 1 0 0 0 0
// 1 represents that Ramu can pack pouches in box, 0 means I can’t in this draw Explainations :
Since at 5th draw he will have 4 pouches with 1, 2, 3, 4 chocolates respectively I can put it in box.
Again in 8th draw I can put it in box. In this draw he also gets to eat 5 chocolates
Rest not possible as they will have 4 candies in each pouch.
Can anyone help me solve this question or add any similar questions i can refer too ?