Solution:
Let r,y,b denote the numbers of red, yellow, and blue coins respectively. Note that each of the three possible exchanges do not change the parities of y−r, b−y, or b−r, and eventually one of these differences becomes zero. Since b−r is the only one of these differences that is originally even, it must be the one that becomes zero, and so Bassanio will end with some number of yellow coins. Furthermore, Bassanio loses a coin in each exchange, and he requires at least five exchanges to rid himself of the blue coins, so he will have at most 12−5=7 yellow coins at the end of his trading.
It remains to construct a sequence of trades that result in seven yellow coins. First, Bassanio will exchange one yellow and one blue coin for one red coin, leaving him with four red coins, three yellow coins, and four blue coins. He then converts the red and blue coins into yellow coins, resulting in 7 yellow coins, as desired.