Raisins(Challenge) Div-2

Can anyone help me understand the approach to this question?