We are given three arrays:
equations: Here, each equations[i] represents a pair of variables [a[i], b[i]], where each a[i] or b[i] is a string that represents a single variable.
values: This array contains real numbers that are the result values when the first variable in equations[i] is divided by the second. For example, if equations[i] = ["m", "n"] and values[i] = 2.0, it means that m / n = 2.0.
queries: Here, each queries[i] represents a pair of variables [c[i], d[i]], where each c[i] or d[i] is a string that represents a single variable. The answer to each query must be calculated as c[i] / d[i].
Given these arrays, find the result of each queries[i] by dividing the first variable with the second. To answer all the queries correctly, use the given equations and values. If it's impossible to determine the answer to any query based on the given equations and values, return
Note: The input is always valid. You may assume that evaluating the queries will not result in division by zero and that there is no contradiction.
Constraints:
equations.length
equations[i].length
a[i].length, b[i].length
values.length equations.length
values[i]
queries.length
queries[i].length
c[j].length, d[j].length
a[i], b[i], c[j], d[j] consist of lower case English letters and digits.
We are given three arrays:
equations: Here, each equations[i] represents a pair of variables [a[i], b[i]], where each a[i] or b[i] is a string that represents a single variable.
values: This array contains real numbers that are the result values when the first variable in equations[i] is divided by the second. For example, if equations[i] = ["m", "n"] and values[i] = 2.0, it means that m / n = 2.0.
queries: Here, each queries[i] represents a pair of variables [c[i], d[i]], where each c[i] or d[i] is a string that represents a single variable. The answer to each query must be calculated as c[i] / d[i].
Given these arrays, find the result of each queries[i] by dividing the first variable with the second. To answer all the queries correctly, use the given equations and values. If it's impossible to determine the answer to any query based on the given equations and values, return
Note: The input is always valid. You may assume that evaluating the queries will not result in division by zero and that there is no contradiction.
Constraints:
equations.length
equations[i].length
a[i].length, b[i].length
values.length equations.length
values[i]
queries.length
queries[i].length
c[j].length, d[j].length
a[i], b[i], c[j], d[j] consist of lower case English letters and digits.