I have a problem finding a good solution to the exchange currency problem. I've spent all the day thinking about this with any elegant and fast solution for all cases.
Statement:
We have some exchange currency rates like...
- EUR to USD -> 1.37
- USD to AUD -> 0.7
- MEX to CAD -> 1.8
- LIB to YEN -> 2.3
- (.....)
This rates are not real and could change once a day. The number of rates could be as big as currencies are in the world (around 150).
We are asked to convert an amount of money from any currency to another one and we should give the answer (if we can) given the exchange currency rates.
The best case is if you exchange is direct (appears on the list), in the worse case you should jump a LOT of times in intermediate exchanges rates.
Note: Given EUR to USD you can assume uSD to EUR is the inverse.
I hope the problem is clear.
Any ideas??