The required number of ways
= 5−1C3−1
= 4C2
=4.32.1=6
Alternative Method: Each box must contain at least one ball since no box remains empty. Boxes can have balls in the systems as shown.
Here balls are identical but boxes are different the number of combinations will be 1 in each systems
∴ Required number of ways
=1×3!2!+1×3!2!
=3+3=6.