399. Evaluate Division
Observation: Turn this into directed graph!
Consider the following case: $\frac a b = v_1$
- build an edge from a $\rightarrow$ b with weight $v_1$
- build an edge from b $\rightarrow$ a with weight $\frac{1}{v_1}$.
Do the same thing for $\frac b c = v_2$.
Compute $\frac a c$, isn’t it just $v_1 * v_2$, the traversal path from a to c? There you go!