ques https://hack.codingblocks.com/contests/c/527/825
when the boy is not paired with the current girl it will surely get a girl from remaining girls so
we are writing f(i,j+1) . but any of the remaining boys can choose the jth girl but in f(i,j+1) they will not be able to pair with the jth girl ???
please tell what exactly is f(i,j) representing ??
Recurrence in Valentine Magic
Actually, both the calls ( f(i+1, j+1)
and f(i, j+1)
) are parallel, so all the cases will be taken into account and the minimum of these 2 will be considered for the final answer. Try to make a recursion tree for the sample TCs for a better understanding.