Delete duplicate value keys from an object - Input={a: 1, b: 2, c: 3, d: 1} Output={a:1,b:2,c:3}
Asked in the Round 2 stage. Coding section of Round 2 post. Implement the task for a Python dictionary, retaining the first key associated with each value and preserving insertion order.
Function: def delete_duplicate_value_keys(obj):
The input is a dictionary with hashable values. Return a new dictionary containing only the first key for each distinct value.
def delete_duplicate_value_keys(obj):