Evaluate Division (LC #399) solves division equations as a weighted graph. If a/b = , create edge a to b with weight and b to a with weight . To evaluate x/y, find a path from x to y and multiply edge weights. Use BFS or DFS. If no path exists, return . If x or y isn't in the graph, return . This runs in where is the number of queries. Union-Find with weighted edges is an alternative. The idea is modeling division as graph traversal.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/meta-interview-prep/graphs/evaluate-division
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█████████████████████████████████████████████████████████████████████████