GeeksforGeeks » Interview Questions
Microsoft - Find the number of ways of placing 3 balls in 3 buckets
(3 posts)-
Find the number of ways of placing 3 balls in 3 buckets. buckets are of diff capacity.
bucket1 can hold 2 balls
bucket2 - 3 balls
bucket3 - 2 balls.ex. 1 1 1 is valid
0 3 0 is valid -
111
120
102
012
021
030
201
210 -
c = 0 N(n) for each i from 0 to 2 for each j from 0 to 3 for each k from 0 to 2 if(i + j + k == n) c++ return c main() N(3)
Reply
You must log in to post.