You are given the following conversion factors:
"""
kilogram gram 1000
kilogram pound 2.21
feet inch 12
...
"""
Now, given from_unit and to_unit, output the conversion factor and if it isn't possible raise an error.
Ex: (pound, gram) -> 454.54
(pound, inch) -> error
This can be solved by converting the above input to Adjancency Hashmap and then doing a BFS/DFS graph traversal while having the information of conversion_factor as an additional element in the queue/stack state (I used BFS).