Search
⌘K

Leetcode 3535. Unit Conversion II

Given a set of pairwise unit conversion ratios, build a weighted graph or use a weighted union-find to answer queries by finding a path between two units and multiplying edge weights to get the conversion factor (returning -1 or equivalent for unreachable/unknown units).


Question Timeline

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

Comments

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