I have N apples and M oranges and few random pairs of (N+M) children.
Distribute N apple and M orange among (N+M) children in such a way that, minimum numbers of pairs of children can have different fruits in a pair.
For better understanding lets take an example:
Ex 1) 2 apples and 1 orange and children=(2+1)=3
Given pairs of children are: (1,2) (2,3)
Now if i give an apple to 1 and 3 and orange to 2, then i will have two pairs with different fruits in a pair. i.e (apple,orange) (orange,apple)
But if i give an apple to 1 and 2 and orange to 3, then i will have only one pair with different fruits in a pair. i.e (apple,apple) (apple,orange).
So answer here is 1 pair which is minimum.
Note:
Number of pairs can be anything but >0 and <= nCr(n=no. of children and r=2)
