Leetcode 399. Evaluate Division
Given pairwise variable ratios, build a weighted graph (or use union-find with multiplicative weights) where edges represent divisions, and answer each query by finding a path between the two variables and multiplying edge weights along that path; return -1.0 if no path (variable undefined) exists.
Asked at:
Amazon
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Early June, 2025
Senior
Hello Interview Premium
Your account is free and you can post anonymously if you choose.