Back to problems

Unit Conversion II

Algorithm · Apple · Medium

Number of Units Equivalent to Base Unit Medium · Topics · Company Tags · Hints You are given n distinct unit types labeled 0 through n - 1. Unit 0 is the base unit. You also have a list conversions, where each element is a triple [source, target, factor] interpreted as: One unit of source equals factor units of target. The conversions collectively form a tree rooted at unit 0 that spans every unit. Every unit except 0 can be reached from unit 0 by following one or more…

Checking your access…