You are given a string initialCurrency and conversion rates for two consecutive days.
You start on Day initialCurrency.
For Day pairs1 and a floating point array rates1, where pairs1[i] = [startCurrency_i, targetCurrency_i] indicates that startCurrency_i converts to rates1[i] units of targetCurrency_i, and targetCurrency_i converts to startCurrency_i.
For Day pairs2 and a floating point array rates2, which define currency conversions for Day
On each day, you may perform any number of currency conversions using the rates available for that day. Conversions can only be made using the rates of the respective day.
Return the maximum amount of initialCurrency you can obtain by the end of Day
Constraints:
initialCurrency.length
initialCurrency consists only of uppercase English letters.
pairs1.length
pairs2.length
pairs1[i] == [startCurrency_i, targetCurrency_i]
pairs2[i] == [startCurrency_i, targetCurrency_i]
startCurrency_i.length, targetCurrency_i.length
startCurrency_i and targetCurrency_i consist only of uppercase English letters.
rates1.length
rates2.length
rates1[i], rates2[i]
The input is generated such that there are no contradictions or cycles in the conversion graphs for either day.
The input is generated such that the output is at most
You are given a string initialCurrency and conversion rates for two consecutive days.
You start on Day initialCurrency.
For Day pairs1 and a floating point array rates1, where pairs1[i] = [startCurrency_i, targetCurrency_i] indicates that startCurrency_i converts to rates1[i] units of targetCurrency_i, and targetCurrency_i converts to startCurrency_i.
For Day pairs2 and a floating point array rates2, which define currency conversions for Day
On each day, you may perform any number of currency conversions using the rates available for that day. Conversions can only be made using the rates of the respective day.
Return the maximum amount of initialCurrency you can obtain by the end of Day
Constraints:
initialCurrency.length
initialCurrency consists only of uppercase English letters.
pairs1.length
pairs2.length
pairs1[i] == [startCurrency_i, targetCurrency_i]
pairs2[i] == [startCurrency_i, targetCurrency_i]
startCurrency_i.length, targetCurrency_i.length
startCurrency_i and targetCurrency_i consist only of uppercase English letters.
rates1.length
rates2.length
rates1[i], rates2[i]
The input is generated such that there are no contradictions or cycles in the conversion graphs for either day.
The input is generated such that the output is at most