Professional Documents
Culture Documents
PROBLEM: Suppose you have 2 jars, jar A and jar B, with unknown
number of identical marbles. Your task is to swap the contents (number
of marbles) of the 2 jars without using any other jar or container.
Example, jar A has 5 marbles while jar B has 3. After swapping, jar A
has now 3 marbles while jar B has 5. See below sample illustration.
Indicate, if any, exemption or limitations of your solution.
AFTER
SWAPPING
A B A B