NEWREST What's wrong with the approach?

Problem link -

take this test case
N=4 M=3 K=2
let’s say the chef knows three types of dishes A, B, and C, now chef can select two dishes and choose which dish he wants to cook on ith day
so the answer should be 3 * (2 * 2 * 2 * 2) = 48.

Here is the picture of all the cases,

the answer for this test case in the problem is given 45 :confused:

You’re double counting the cases with only one dish (AAAA, BBBB, CCCC).

If you remove those, then you’ll get the right answer.