@Anush Actually I don't. I thought it was the same as your last cmc (
this one) and my answer to it uses a very simple closed-form formula. The main challenge is totally different (by adding the parameter
m
) and it doesn't have one. (It is possible to directly calculate the necessary numbers but it takes worse time than plain DP)