Search
⌘K

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

Amazon


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Early June, 2025

Amazon

Amazon

Senior

Comments

Your account is free and you can post anonymously if you choose.