This is not the question of programming rather its maths question can anyone provide me a detail solution of the problem

U r given N buckets each bucket contain balls of different color(each bucket has infinite number of balls).You have to choose k balls(K>=N)such that combination of K balls contain atleast 1 ball from each bucket in other words all colors of ball(N colors) should be present in that combination of k balls.

@nil96 : You first choose 1 ball from each of the N buckets , that is compulsory . Then for each of the K-N balls further to be chosen , balls from all N buckets can be chosen . So answer is N^(K-N) .