Back to problems

Decipher using two hashmaps

Algorithm · Upstart · Easy

You receive two dictionaries, dict1 and dict2. Read each dictionary once to decode the relationship between them. When a value in dict1 appears as a key in dict2, use that connection to build the corresponding pattern. A suitable function signature is: Return a dictionary that preserves each key from dict1 and replaces its value with the matching value from dict2. Example Input: Output: Each value in the first dictionary is looked up as a key in the second dictionary,…

Checking your access…